[R] "optim" and "nlminb"

John C Nash nashjc at uottawa.ca
Thu Oct 11 18:56:24 CEST 2012


It appears you are using the approach "throw every method at a problem and select the
answer you like". I use this quite a lot with optimx to see just what disasters I can
create, but I do so to see if the software will return sensible error messages.

You will have to provide a reproducible example if you want useful answers from this list
(as per posting guide). Optimization tools are like F1 racing cars -- many controls and
settings, with lots of power but difficulties in controlling it. Their users -- even if
well-qualified in other areas -- are unfortunately often those who have trouble riding a
bicycle with just one speed. There is a serious and quite involved learning curve.

Previously you tried optimx, but seem to have misunderstood or disregarded the answers. It
is quite likely the problem you are sending to the optimizers is ill-posed or plain wrong.
Certainly it does not have a gradient function, which is almost always a good idea. If you
prepare a reproducible example that can be run by readers of the list you will
  a) discover what is wrong as you prepare it, or
  b) be able to submit and very likely get useful help.

Indeed in several years on the list, I've never seen a query with a short, testable case
fail to get an answer very quickly.

JN


On 10/11/2012 06:00 AM, r-help-request at r-project.org wrote:
> Message: 92
> Date: Wed, 10 Oct 2012 13:16:38 -0700 (PDT)
> From: nserdar <snes1982 at hotmail.com>
> To: r-help at r-project.org
> Subject: [R] "optim" and "nlminb"
> Message-ID: <1349900198210-4645772.post at n4.nabble.com>
> Content-Type: text/plain; charset=us-ascii
> 
> 
> #optim package
> estimate<-optim(init.par,Linn,hessian=TRUE, method=c("L-BFGS-B"),control =
> list(trace=1,abstol=0.001),lower=c(0,0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf))
> 
> #nlminb package
> estimate<-nlminb(init.par,Linn,gr=NULL,hessian=TRUE,control =
> list(trace=1,factr=1),lower=c(0,0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf))
> 
> I did not get same results from above equations. Log-likelihood values are
> close but parameter estimation completely different. 
> 
> My expectation is very close to "nlminb" packages.
> 
> Do you have any idea and suggestion between packages?
> 
> Regards,
> Serdar 
>




More information about the R-help mailing list