MATLAB: Matlab: Get the Hessian matrix using Multistart

fminconmultistart

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…

Best Answer

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