FMINCON not solving for different specifications of logit model

1 view (last 30 days)
Hi,
I am using FMINCON to minimize the squared errors between an set of observations and a logisitic model as shown below. All the 500 solver runs converges with a positive local solver flag if I use the first psi_calculate function (to calculate the logit). If I use the second psi_calculate function, only one of the 500 solvers converge to a positive local solver flag. However, both should yield the same solution. I am not sure why when the logit is specified of the form 1/(1+e^x) it works well, but e^x/(1+e^x) does not!. I am particularly interested in using the second specification because, I want to extend the model to a nested multinomial logistic model. Thanks.
%% Part of the code where I use fmincon
f= @(x) sum((LULC_1995-psi_calculate(x,xdata,veg_no))).^2;*
% LULC_1995 is a vector of observations..x is parameters I am solving for, xdata is the explanatory variables which is a matrix with some n number of columns and rows equal to the LULC_1995 vector
opts = optimset('fmincon');
options = optimset(opts,'Diagnostics','off','Display','iter','TolFun',1e-1,'TolX',1e-6,'MaxFunEvals',25e+1000,'MaxIter',25e+5000,'Algorithm','interior-point');*
problem=createOptimProblem('fmincon','x0',x0,'objective',f,'lb',lb,'ub',ub,'Aineq',Aineq,'bineq',bineq,'options',options);
ms = MultiStart('UseParallel','always');
[op,error] = run(ms,problem,500);
%%%%%%%%%
The psi_calculate function which works well:
function temp = psi_calculate(x,xdata,veg_no)
lt=size(xdata,2);
temp=1./(1+exp(x(21)+(double(xdata)*x(1:lt))));
end
The psi_calculate function which does not work well:
function temp = psi_calculate(x,xdata,veg_no)
lt=size(xdata,2);
temp=exp(x(21)+(double(xdata)*x(1:lt)))./(1+exp(x(21)+ (double(xdata)*x(1:lt))));
temp = 1-temp;
end
Thanks,
MP
  3 Comments
Prasanth
Prasanth on 10 Jul 2014
Thanks for pointing it out the typo, Matt. I have corrected it.

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!