Sally Luo
2010-Aug-25 15:26 UTC
[R] What does this warning message (from optim function) mean?
Hi R users, I am trying to use the optim function to maximize a likelihood funciton, and I got the following warning messages. Could anyone explain to me what messege 31 means exactly? Is it a cause for concern? Since the value of convergence turns out to be zero, it means that the converging is successful, right? So can I assume that the parameter estimates generated thereafter are reliable MLE estimates? Thanks a lot for your help. Maomao ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> p<-optim(c(0,0,0), f, method ="BFGS", hessian =T, y=y,X=X,W=W)There were 31 warnings (use warnings() to see them)> warnings()Warning messages: 1: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 2: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 3: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 4: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 5: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 6: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 7: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 8: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 9: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 10: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 11: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 12: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 13: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 14: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 15: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 16: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 17: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 18: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 19: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 20: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 21: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 22: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 23: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 24: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 25: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 26: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 27: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 28: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 29: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 30: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 31: In if (hessian) { ... : the condition has length > 1 and only the first element will be used> p$countsfunction gradient 148 17> p$convergence[1] 0 [[alternative HTML version deleted]]
Prof Brian Ripley
2010-Aug-25 18:37 UTC
[R] What does this warning message (from optim function) mean?
You mean 'TRUE': 'T' is a variable in R, with initial value TRUE. On Wed, 25 Aug 2010, Sally Luo wrote:> Hi R users, > I am trying to use the optim function to maximize a likelihood funciton, and > I got the following warning messages. > Could anyone explain to me what messege 31 means exactly? Is it a cause for > concern? > Since the value of convergence turns out to be zero, it means that the > converging is successful, right? > So can I assume that the parameter estimates generated thereafter are > reliable MLE estimates? > Thanks a lot for your help. > > Maomao > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> p<-optim(c(0,0,0), f, method ="BFGS", hessian =T, y=y,X=X,W=W) > > There were 31 warnings (use warnings() to see them) > >> warnings() > > Warning messages: > > 1: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 2: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 3: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 4: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 5: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 6: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 7: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 8: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 9: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 10: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 11: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 12: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 13: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 14: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 15: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 16: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 17: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 18: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 19: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 20: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 21: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 22: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 23: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 24: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 25: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 26: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 27: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 28: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 29: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 30: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced > > 31: In if (hessian) { ... : > > the condition has length > 1 and only the first element will be used > >> p$counts > > function gradient > > 148 17 > >> p$convergence > > [1] 0 > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Cheng Peng
2010-Aug-25 18:53 UTC
[R] What does this warning message (from optim function) mean?
the deteminant is a nonpositive value..... log(det(...)) produce NaNs... -- View this message in context: http://r.789695.n4.nabble.com/What-does-this-warning-message-from-optim-function-mean-tp2338689p2338719.html Sent from the R help mailing list archive at Nabble.com.
Ravi Varadhan
2010-Aug-25 20:20 UTC
[R] What does this warning message (from optim function) mean?
Hi, You did not give us any information about your likelihood function, f, nor did you provide a reproducible example. So, I cannot tell for sure whether the parameter estimates are reliable. Ravi. -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Sally Luo Sent: Wednesday, August 25, 2010 11:26 AM To: r-help at r-project.org Subject: [R] What does this warning message (from optim function) mean? Hi R users, I am trying to use the optim function to maximize a likelihood funciton, and I got the following warning messages. Could anyone explain to me what messege 31 means exactly? Is it a cause for concern? Since the value of convergence turns out to be zero, it means that the converging is successful, right? So can I assume that the parameter estimates generated thereafter are reliable MLE estimates? Thanks a lot for your help. Maomao ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> p<-optim(c(0,0,0), f, method ="BFGS", hessian =T, y=y,X=X,W=W)There were 31 warnings (use warnings() to see them)> warnings()Warning messages: 1: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 2: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 3: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 4: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 5: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 6: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 7: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 8: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 9: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 10: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 11: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 12: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 13: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 14: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 15: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 16: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 17: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 18: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 19: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 20: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 21: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 22: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 23: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 24: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 25: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 26: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 27: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 28: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 29: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 30: In log(det(I_N - pd * wd - po * wo - pw * ww)) : NaNs produced 31: In if (hessian) { ... : the condition has length > 1 and only the first element will be used> p$countsfunction gradient 148 17> p$convergence[1] 0 [[alternative HTML version deleted]] ______________________________________________ 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.