How to calculate the second derivative of an unanalytically function

2 ビュー (過去 30 日間)
xueqi
xueqi 2014 年 12 月 11 日
コメント済み: Sean de Wolski 2014 年 12 月 15 日
Dear All,
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.
Xueqi
  3 件のコメント
xueqi
xueqi 2014 年 12 月 15 日
Hi thanks for our advice. But I am not sure exactly I should implement this. How should I decide h?
John D'Errico
John D'Errico 2014 年 12 月 15 日
Why don't the derivest tools (the Hessian computation) work?
All it needs is that your function return a scalar, and that it be sufficiently smooth. If your function does not return a scalar, how do you define the Hessian matrix anyway? And if it is not smooth, how would you compute the derivatives you desire?
There is no need for your function to be in any symbolic form. A black box function is fine.

サインインしてコメントする。

回答 (1 件)

Sean de Wolski
Sean de Wolski 2014 年 12 月 11 日
編集済み: Sean de Wolski 2014 年 12 月 11 日
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.
  3 件のコメント
Sean de Wolski
Sean de Wolski 2014 年 12 月 15 日
No, if you want to use the analytical gradient, which you do not have, then you need to. Otherwise it will solve it with finite differences.
Sean de Wolski
Sean de Wolski 2014 年 12 月 15 日
x = fmincon(@sin,5,[],[],[],[], 0, 10)
No gradient or hessian supplied.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by