Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to save a hessian matrix for post-estimation analysis?

To   "" <>
Subject   Re: st: How to save a hessian matrix for post-estimation analysis?
Date   Tue, 21 Aug 2012 18:56:55 +0800 (CST)

Dear Gordon, 
Thanks for the answer. It seems that there is no easy way to use the official command, e.g. “logit”, “mprobit”, etc., and save the original hessian.

By the way, I wonder that, if the negative hessian is singular or not positive definite, is there any drawback to using the generalised inverse hessian? I know that some standard errors in the output will be labelled with a dot, which means we can’t do the statistical tests for those predictors. How about the other standard errors appearing as usual? We can use them to do the test, but will them cause invalid results?
Thanks for the help.
Best Regards,
Chi-lin Tsai
----- Original Message -----
From: Gordon Hughes <>
Sent: Monday, 20 August 2012, 17:13
Subject: Re: st: How to save a hessian matrix for post-estimation analysis?

There is no general answer to this question.  Further, it is unclear whether you are interested in recovering the Hessian for a standard Stata ML command or for an ML procedure that you have written yourself.

For standard Stata procedures, the Hessian option in -maximize- controls printed log output rather than what matrices are saved.  If you really need the Hessian, you will almost certainly have to modify the Stata procedure - producing your own variant -my_xxx- to persuade either -ml- or -optimize/moptimize- (in Mata) to return and save the Hessian in a specified Stata matrix.  Of course, this may be quite a lot of effort to avoid degenerate examples of e(V), most of which can be handled by some simple Mata commands calling either qrinv() or pinv() to construct a generalised inverse.

If you are writing your own ML procedure, then the most direct way of getting to the Hessian is to use -optimize- in a Mata procedure which provides optimize_result_Hessian as a way of recovering the Hessian.


Gordon Hughes


Dear Statalist,

I'm looking for a way to save a hessian matrix. Specifically, when fitting a likelihood-based model, I know that specifying the option "hessian" can show the hessian matrix, but how can I store it for post-estimation analysis?

I don't wanna got the hessian matrix via "-1*invsym(e(V))", because under certain circumstances, that can't recover the original hessian matrix. (For example, when the hessian matrix is not negative definite, some columns and rows of the e(V) will be set to be zero. Then, "-1*invsym(e(V))" cannot recover the original hessian matrix.)

Thanks for the help in advance.

Best Regards,

Chi-lin Tsai

*  For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index