[R] How to catch errors regarding the hessian in 'optim'

Simon Zehnder szehnder at uni-bonn.de
Sun Sep 1 17:09:35 CEST 2013


Dear R-Users and R-Developers,

in a comparison between two different estimation approaches I would like to catch errors from optim regarding the hessian matrix.

I use optim with method = "L-BFGS-B" thereby relying on numerical differentiation for the hessian matrix. I do know, that the estimation approach that uses numerical optimization has sometimes problems with singular hessian matrices and I consider it as one of its disadvantages of this method. To show the frequency of such problems in my simulation study I have to set 'hessian = TRUE' and to collect the errors from optim regarding the hessian.

Now I am a little stucked how I could catch specifically errors from the hessian matrix in 'optim'. I do know that such errors are thrown most certainly from function 'La_solve' in Lapack.c. Does anyone has an idea how I could solve this task (clearly with tryCatch but how to choose only errors for the hessian)?


Best 

Simon
 


More information about the R-help mailing list