Matlab: Get the Hessian matrix using Multistart
10 views (last 30 days)
Show older comments
Charles Martineau
on 27 Aug 2014
Answered: Charles Martineau
on 27 Aug 2014
I am using Multistart in Matlab with the `fmincon` command to estimate some parameters to my maximum likelihood function. The issue that I have with Multistart is that I can't get the Hessian matrix. It is easy to get the Hessian with `fmincon` but how to retrieve it using Multistart, I am absolutely clueless despite some explanation by MatWork here . They say:
"If you use GlobalSearch or MultiStart, your objective function can return derivatives (gradient, Jacobian, or Hessian). For details on how to include this syntax in your objective function, see Writing Objective Functions in the Optimization Toolbox documentation"
I tried to understand their documentation but still clueless.
Here's my current Multistart code:
options = optimset(options,'Algorithm','sqp','MaxFunEvals',10000,'MaxIter',10000);
problem = createOptimProblem('fmincon','objective', @(x)myfunc(x),'x0',initialparameter,'lb',[min],'ub',[max],'options',options);
ms = MultiStart('UseParallel','always','Display','iter','TolX',1e-8);
[x fval] = run(ms,problem,20);
Where in my code should I specify that I want to retrieve the Hessian? I tried `'Hessian','on'` in `optimset` but that didn't give me the Hessian matrix...
0 Comments
Accepted Answer
Alan Weiss
on 27 Aug 2014
MultiStart does not return the Hessian. But, if you really want the Hessian for computing confidence intervals, you shouldn't use the fmincon Hessian anyway, because, as documented, it is inaccurate.
I do not know what the confidence interval calculation is when there are active constraints in a maximum likelihood calculation. If, at the end of the calculation, there are no active constraints, then you can call fminunc on the function at the final point. As documented, fminunc Hessians are accurate.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
More Answers (2)
Matt J
on 27 Aug 2014
Edited: Matt J
on 27 Aug 2014
You cannot use the Hessian with the sqp algorithm option, only with interior point and trust-region-reflective. The Hessian computation is specified in different ways depending on the fmincon algorithm uses. You must choose a value for the Hessian option following the guidelines here,
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!