[R] optim with constraints

Prof. John C Nash nashjc at uottawa.ca
Mon Dec 7 15:01:01 CET 2009


Without the data / script, I'm guessing that it is likely an attempt to evaluate the loss 
function at an inadmissible point e.g., at the constraint where there is a log(0). 
Different optimization tools handle things differently, and there are a couple of us 
working (very slowly due to other things) on trying to provide a nice wrapper to catch 
these exceptions so that they can be handled better.

JN


> Message: 56
> Date: Sun, 6 Dec 2009 17:32:54 -0800 (PST)
> From: Steven <ytsteven at gmail.com>
> Subject: Re: [R] optim with constraints
> To: r-help at r-project.org
> Message-ID:
> 	<88d5c01d-c30c-4e91-900c-2b825d5e3be8 at z4g2000prh.googlegroups.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Hi, Prof Nash
> 
> Thanks for your comment!
> 
> I modified my code to be (added an extra parametr):
> 
> optim(c(1.14,0.25,0.06), weibull.like, mydata=mydata, method="L-BFGS-
> B", hessian = TRUE, lower = c(0, 0, 0), upper = c(Inf, Inf, 1))
> 
> But I had the following error:
> 
> Error in optim(c(1.14, 0.25, 0.06), weibull.like, mydata = mydata,
> method = "L-BFGS-B",  :
>   non-finite finite-difference value [2]
> 
> What does that mean? Much appreciate your help!
> 
> Steven
>




More information about the R-help mailing list