How to calculate the second derivative of an unanalytically function
5 views (last 30 days)
I use fmincon to optimize my likelihood function f (there are four parameters in f . And it is not in an analytic form. It needs to read in data and call other children function, etc). I also want the standard errors so I have tried to get the Hessian (more accurate, the diagonal part of it, which is the second derivative of the f at the optima). But Hessian provided by fmincon is the Hessian of the Lagrangian so I can not use it.
I tried John D'Errico's method . But in this method, it requires f to be scalar and analytic.
So I really have not idea at this moment. I think my problem is essentially about how to calculate the second derivative of an analytic function. Could anybody help me with this please? Thanks very much.
Sean de Wolski on 11 Dec 2014
Edited: Sean de Wolski on 11 Dec 2014
Why not just let fmincon use finite differencing?
If that is not working, then it's possible that your function is discontinuous or non-differentiable and you should look at using one of the non gradient based solvers like patternsearch.