[R] Error in eigen(nhatend)

Prof J C Nash (U30A) nashjc at uottawa.ca
Sat Jun 6 18:47:21 CEST 2015


It looks like the matrix nhatend (for Numerical Hessian AT END) has some
NAs or Infs.

Suggest you turn off the Hessian calculation by

argument   hessian=FALSE (that is the default)
and control=list(kkt=FALSE)  (the default is TRUE for "small" problems")

Then take the resulting final parameters and use the package numDeriv to
get the numerical hessian and try to see if you can then do eigen() on it.

optimx is really just a wrapper for a lot of the calculations people
want to do with optimizers, so diagnosing this kind of thing is best
done in a pedestrian fashion by trying to replicate the calculation
outside the package.

Note that the Jacobian of the gradient (from numDeriv) is more accurate
if you have analytic gradients than the hessian() function, which needs
two levels of differencing and can give poor approximations for many
functions. This may, in fact, be the source of the reported error.

Note also that there are a couple of (really stupid) typos in optimx and
Rvmmin packages. They don't affect most users. I've fixed them, but am
having trouble with reverse dependency checks, which I believe are
problems outside of my packages. However, I'm hoping to resolve those
issues before I post the fixed packages on CRAN.

JN


On 15-06-06 06:00 AM, r-help-request at r-project.org wrote:
> Message: 26
> Date: Fri, 5 Jun 2015 10:43:23 -0700
> From: Olu Ola <oluola2011 at yahoo.com>
> To: r-help at r-project.org
> Subject: [R] Error in eigen(nhatend)
> Message-ID:
> 	<1433526203.5741.YahooMailBasic at web161604.mail.bf1.yahoo.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Hello,
> I am estimating a nonlinear GMM and I got the following error message. I have searched online in other to understand what is going on but could not find help
> 
>> > ngmm = optimx(par=b0, fn=object,gr=gred, method = c("BFGS","nlminb","nlm"), itnmax=10000, control=list(follow.on = TRUE,starttests=TRUE, save.failures=TRUE, trace=0))
> Error in eigen(nhatend) : infinite or missing values in 'x'
> In addition: Warning messages:
> 1: In optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,  :
>   Hessian is reported non-symmetric with asymmetry ratio NaN
> 2: Hessian forced symmetric 
> Error in ans.ret[meth, ] <- c(ans$par, ans$value, ans$fevals, ans$gevals,  : 
>   number of items to replace is not a multiple of replacement length
> In addition: Warning message:
> In optimx.run(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower,  :
>   Eigenvalue failure after method BFGS
> 
> A way forward will be highly appreciated.
> 
> Thank you



More information about the R-help mailing list