When I run your problem in optimx (with all.methods=TRUE), L-BFGS-B fails 
because the
function is evaluated out of range. optimx (actually the optfntools package) 
from R-forge
can trap these, and it is usually a good idea to stop and figure out what is 
going on.
Nevertheless, it seems a solution can be found by other methods, and even by 
L-BFGS-B if
one is prepared to ignore these "glitches".

A big +++ for including an executable example. Of course, I would not have 
answered otherwise.

Note that the optimx and optfntools on R-forge are at the moment undergoing a 
lot of
review and change.

Best, JN


> Message: 4
> Date: Tue, 8 May 2012 14:35:10 -0500
> From: Wenhao Gui <guiwen...@gmail.com>
> To: r-help@r-project.org
> Subject: [R] optim question
> Message-ID:
>       <CABZdO=zKr1wsXmTOQ54UieVQfpkAx=cyt0dzip7yt1cjb6e...@mail.gmail.com>
> Content-Type: text/plain
> 
> Hello,
> 
> I used optim to find the MLE estimates of some parameters.  See the code
> below.  It works for data1(x). but It did not work for data2 and the error
> says" L-BFGS-B needs finite values of 'fn' ".
> 
> data2:   c(x, 32)  that is, if I added the number 32 at the end of data1.
> The error appears "non-finite function value" etc.
> 
> Any comments or suggestions?
> 
> Thanks!
> 
> Wenhao
>

______________________________________________
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.

Reply via email to