my mistake. since nlminb is minimizing, it should be +Inf ( so that the likelihood is large ) as you pointed out. Note that this approach is a heuristic and may not work all the time.
On Mon, Oct 21, 2013 at 3:01 AM, Steven LeBlanc <ores...@gmail.com> wrote: > > On Oct 20, 2013, at 9:54 PM, Mark Leeds <marklee...@gmail.com> wrote: > > > Bill: I didn't look at the code but I think the OP means that during the > nlminb algorithm, > > the variance covariance parameters hit values such that the covariance > matrix estimate becomes negative definite. > > Yes, that is what I meant. > > > > > Again, I didn't look at the details but one way to deal with this is to > have the likelihood > > function return -Inf whenever the covariance matrix becomes not positive > definite. so, the > > likelihood should check for positive definiteness first before it > actually calculates anything. > > If PD is not true, the -Inf value should push nlminb towards values that > obtain a positive definite matrix. But there could be something more subtle > going on that I'm not understanding. I don't know even what algorithm > nlminb is using ( probably quasi-newton ) but this is one thing the OP > could try. > > I tried this at your suggestion. nlminb() seems to hang at -Inf, but Inf > works splendidly. Thanks much! > > [[alternative HTML version deleted]] ______________________________________________ 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.