Paul Gilbert <pgilbert <at> bank-banque-canada.ca> writes: > > It seems more likely that the return value from your function > is NA or NaN or Inf. This might then result in an > NA parameter value being calculated for the next step. > This is possible, for example, because the line > search extends outside the feasible region. You can > re-write your function to check for that case and > return a large negative value (or positive if minimizing), > or stop() if that is more appropriate. > > Paul >
But it seems likely that if that happens the optimizer (optim, nlminb, whatever) would get to a state within the next few steps where it would stop with an error. Ravi suggests 'trace', which is a good idea. Having this happen in the middle of batch runs is a nuisance -- it rules out a lot of the interactive debugging tools -- but you can also use the old-fashioned, low-tech solution of adding lots of cat(...,"\n") statements to your objective function to see what's going on. ______________________________________________ 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.