kaskr / adcomp

AD computation with Template Model Builder (TMB)
Other
166 stars 80 forks source link

Hessian matrix #15

Open cadigann opened 10 years ago

cadigann commented 10 years ago

Hello All

I am a new user with little experience with cpp so be nice to me.

obj$fn and obj$gr in TMB examples return the function value to minimize, and its gradient. obj$he() is there too, and it seems to return the hessian. When I run obj$he(par) I get the error message:

Error in .Call("tmb_invQ_tril_halfdiag", L, PACKAGE = "TMB") : 'L' is missing

None of the examples use the hessian in nlminb so I am thinking this error is expected and TMB is not returning the hessian function,

Am I correct?

thks noel cadigan

kaskr commented 10 years ago

Hi Noel,

The analytical Hessian obj$he currently only works for models without random effects. As you correctly point out, you don't need obj$he in order to use nlminb or sdreport.

Kasper

cadigann commented 10 years ago

Thanks Kasper

For curiosity, I ran TMB+nlminb for a problem with no random effects but about 700 parameters and 12000 observations. without using hessian. runtime 3.41 sec, outer mgc: 0.08780289 using hessian: runtime 51.20 sec, outer mgc: 0.001555197

Using the hessian gives a better result in terms of mgc but much slower. I need to figure out how to get nlminb from stopping interations too soon

cadigann commented 10 years ago

sorry I closed by mistake