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

Prof J C Nash (U30A) nashjc at uottawa.ca
Mon Sep 2 16:42:01 CEST 2013


This may be one of the many mysteries of the internals of L-BFGS-B, 
which I have found fails from time to time. That is one of the reasons 
for Rvmmin and Rcgmin (and hopefully sooner rather than later Rtn - a 
truncated Newton method, currently working for unconstrained problems, 
but still glitchy for bounds constraints). These are all-R codes so that 
users and developers can get inside to control special situations.

If you have a test problem -- the infamous reproducible example -- there 
are several of us who can likely help to sort out your troubles.

JN


On 13-09-02 06:00 AM, r-help-request at r-project.org wrote:
> Message: 10
> Date: Sun, 1 Sep 2013 17:09:35 +0200
> From: Simon Zehnder<szehnder at uni-bonn.de>
> To: R-help help<r-help at r-project.org>
> Subject: [R] How to catch errors regarding the hessian in 'optim'
> Message-ID:<EB37670E-8544-4C89-9172-245EB6CC596A at uni-bonn.de>
> Content-Type: text/plain; charset=us-ascii
>
> 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