Error in eigen(nhatend)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in eigen(nhatend)

R help mailing list-2
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Error in eigen(nhatend)

Prof J C Nash (U30A)
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, [hidden email] wrote:

> Message: 26
> Date: Fri, 5 Jun 2015 10:43:23 -0700
> From: Olu Ola <[hidden email]>
> To: [hidden email]
> Subject: [R] Error in eigen(nhatend)
> Message-ID:
> <[hidden email]>
> 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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.