All: I am getting an error code from the optimization function. The code is Error in optim(p,fun.LLike, lower=low, upper = up, method = "L-BFGS-B", : non-finite finite-difference value [0] If I add a trace=6 option to my control list the last message before this error is: At X0, 0 variables are exactly at the bounds Any ideas on where I should start would be appreciated. Tony -- Tony Long Ecology and Evolutionary Biology Steinhaus Hall University of California at Irvine Irvine, CA 92697-2525 Tel: (949) 824-2562 (office) Tel: (949) 824-5994 (lab) Fax: (949) 824-2181 email: tdlong at uci.edu http://hjmuller.bio.uci.edu/~labhome/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
My guess is that you should start with the setting of ndeps (see ?optim). If your function gives bad results for parameters outside of the bounds you have set, you probably need to set the bounds a tiny bit smaller and then set ndeps tinier still so that the finite-difference approximation to the derivatives doesn't try to evaluate the function outside the bounds ... (Q for Brian Ripley: does this seem reasonable? Or does L-BFGS-B actually check to make sure that finite differences are always evaluated inside the boundaries? Based on my experience with optim/L-BFGS-B I don't think so, but I'm not sure) The other thing you can do for debugging this kind of problem is to turn on some tracing in your function itself (with a cat() or print() statement) that reports the parameters at which the function is evaluated. Ben Bolker On Tue, 25 Sep 2001, Tony Long wrote:> All: > > I am getting an error code from the optimization function. The code is > > Error in optim(p,fun.LLike, lower=low, upper = up, method = "L-BFGS-B", : > non-finite finite-difference value [0] > > If I add a trace=6 option to my control list the last message before > this error is: > At X0, 0 variables are exactly at the bounds > > Any ideas on where I should start would be appreciated. Tony >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Tue, 25 Sep 2001, Tony Long wrote:> All: > > I am getting an error code from the optimization function. The code is > > Error in optim(p,fun.LLike, lower=low, upper = up, method = "L-BFGS-B", : > non-finite finite-difference value [0] > > If I add a trace=6 option to my control list the last message before > this error is: > At X0, 0 variables are exactly at the bounds > > Any ideas on where I should start would be appreciated. TonyIt means that in computing derivatives by finite differencing, one of the values is NA, +Inf or -Inf. Put some print values in your objective function and find out why it is giving a non-finite value. It's not an error in optim: it is supposed to work that way. -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Tue, Sep 25, 2001 at 10:53:44AM -0700, Tony Long wrote:> All: > > I am getting an error code from the optimization function. The code is > > Error in optim(p,fun.LLike, lower=low, upper = up, method = "L-BFGS-B", : > non-finite finite-difference value [0] > > If I add a trace=6 option to my control list the last message before > this error is: > At X0, 0 variables are exactly at the bounds > > Any ideas on where I should start would be appreciated. Tony > --Generally, in this situation transforming the problem is not very useful. If the optimal point really is on the boundary you need to use a method suited to that. Most good optimization books (Fletcher, Gill Murray and Wright) discuss methods of this form. These issues often arise with mixture problems and the software for those problems can be used if you can frame your question in a mixture framework. This is often the case. For example, almost all univariate censored data CDF estimation problems can be dealt with this way. Robert> > Tony Long > > Ecology and Evolutionary Biology > Steinhaus Hall > University of California at Irvine > Irvine, CA > 92697-2525 > > Tel: (949) 824-2562 (office) > Tel: (949) 824-5994 (lab) > Fax: (949) 824-2181 > > email: tdlong at uci.edu > http://hjmuller.bio.uci.edu/~labhome/ > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-- +---------------------------------------------------------------------------+ | Robert Gentleman phone : (617) 632-5250 | | Associate Professor fax: (617) 632-2444 | | Department of Biostatistics office: M1B28 | Harvard School of Public Health email: rgentlem at jimmy.dfci.harvard.edu | +---------------------------------------------------------------------------+ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._