Analytic_derivation help

Hi everyone,
I’m trying to estimate a very simple NKM using ML and the analytic_derivation command.
Everything seems to work quite well untill now.
I would like to know if there is anyway to save the Jacobian and the Hessian matrix that boil down triggering the analytic_derivation command.
It’s seems in fact that dynare( version 4.3.2) store both the matrices in a folder called “tmp_derivs” but this folder is only temporary. Am I correct?
Is there a way to save them?

Thanx you very much in advance.


Hi Federico,

which Jacobian and Hessian do you need? For the estimated params at the mode the analytic Hessian is saved on the mode file.

Sorry, I missed that. It’s what i need. Sorry again.
Just to be sure the mat file hh is the hessian while xparam1 is the Jacobian?
And what are the files stored in the “tmp_derivs” folder?

Thanx again Marco



hh is the hessian, while xparam1 is the vector of parameters.
Then I guess you would ask for the gradient of the likelihood: this is not saved in the mode file.
If I remember correctly g1.mat for mode_compute=4 and m1.mat for mode_compute=5 should include variables named g* for the gradient.

Yes, I nedd the hessian and the gradient of the likelihood.
unfortunately it seems that there is no g1.mat using mode_compute =4 and mode_compute =5 but the estimation does not even start .
( I 'm using octave versione 3.6.4 and dynare 4.3.2) . Previously I used mode_compute = 8 but still nothing ( Anyway both under 4 and 8 the estimation was fine).
Any other suggestion on How i could obtain the jacobian?


Sorry, I made another mistake.
Using mode_compute = 4 there is a mat file called g1. If this file contains the gradient I have what I need.

So just to be sure.

the hessian (evaluate at the posterior mode) is saved under the filename.mode.mat in the hh.mat file
while the gradient (evaluate at the posterior mode) is saved under the g1.mat file (using mode_compute =4)?

Yes. hh is the Hessian and g1 contains the Jacobian (at the respective mode).