nikkks
2012-Jul-25 05:50 UTC
[R] zeroinfl problem: cannot get standard errors, hessian has NaN
Hi! I have three models. In the first model, everything is fine. However, in the second and third models, I have NA's for standard errors: The hessians also have NaN's (same for m2 and m3). What should I do about it? It there a way to obtain the hessian without transforming my variables? I will greatly appreciate your help! -- View this message in context: http://r.789695.n4.nabble.com/zeroinfl-problem-cannot-get-standard-errors-hessian-has-NaN-tp4637715.html Sent from the R help mailing list archive at Nabble.com.
Joshua Wiley
2012-Jul-25 07:23 UTC
[R] zeroinfl problem: cannot get standard errors, hessian has NaN
Hi, This is not nearly enough information. Please follow the posting guide and provide us with a reproducible example, or at the bare minimum, the code for your models. Without more details we can only wildly guess, but here are a few: ---You have more parameters than your data can support (the Hessian is the matrix of partial second derivatives, and SEs are typically based closely on the hessian (or rather the information matrix, the negative of the hessian). ---you have some redundant effects? Try a simpler model and see if you can find some particular parameter that leads to the problem. You could also try tweaking optimization options, but I that is usually not the source of the problem. We really need more information, with the ideal being putting data that reproduces your problem (or your actual data) online somewhere where we can easily download it, and providing us with all your model code, so on our machines, we can exactly reproduce what is happening for you and try to troubleshoot. Cheers, Josh On Tue, Jul 24, 2012 at 10:50 PM, nikkks <nikita at sagowarrior.com> wrote:> Hi! > > I have three models. > > > > In the first model, everything is fine. > > > > > However, in the second and third models, I have NA's for standard errors: > > > > > > The hessians also have NaN's (same for m2 and m3). > > > > What should I do about it? It there a way to obtain the hessian without > transforming my variables? I will greatly appreciate your help! > > > > -- > View this message in context: http://r.789695.n4.nabble.com/zeroinfl-problem-cannot-get-standard-errors-hessian-has-NaN-tp4637715.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.-- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/
Achim Zeileis
2012-Jul-25 07:28 UTC
[R] zeroinfl problem: cannot get standard errors, hessian has NaN
It's hard to say what exactly goes wrong without a reproducible example (see the posting guide). However, a typical source of such problems is that some regressors are scaled badly. Maybe you have one regressor that takes very large values or squares of a regressor that takes moderately large values? The result would be that the associated coefficients become tiny and the hessian is conditioned badly. The simple solution is to scale the problematic regressor so that it's coefficient is reasonably sized (e.g., divide by 1000 or 10000 or so). (sent from mobile phone) -------- Original message -------- Subject: [R] zeroinfl problem: cannot get standard errors, hessian has NaN From: nikkks <nikita@sagowarrior.com> To: r-help@r-project.org CC: Hi! I have three models. In the first model, everything is fine. However, in the second and third models, I have NA's for standard errors: The hessians also have NaN's (same for m2 and m3). What should I do about it? It there a way to obtain the hessian without transforming my variables? I will greatly appreciate your help! -- View this message in context: http://r.789695.n4.nabble.com/zeroinfl-problem-cannot-get-standard-errors-hessian-has-NaN-tp4637715.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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. [[alternative HTML version deleted]]
nikkks
2012-Jul-25 08:04 UTC
[R] zeroinfl problem: cannot get standard errors, hessian has NaN
Thank you, Achim! Rescaling worked and all is fine now! -- View this message in context: http://r.789695.n4.nabble.com/zeroinfl-problem-cannot-get-standard-errors-hessian-has-NaN-tp4637715p4637732.html Sent from the R help mailing list archive at Nabble.com.