"optim" and "nlminb"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

"optim" and "nlminb"

nserdar

#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
Reply | Threaded
Open this post in threaded view
|

Re: "optim" and "nlminb"

Prof J C Nash (U30A)
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, [hidden email] wrote:

> Message: 92
> Date: Wed, 10 Oct 2012 13:16:38 -0700 (PDT)
> From: nserdar <[hidden email]>
> To: [hidden email]
> Subject: [R] "optim" and "nlminb"
> Message-ID: <[hidden email]>
> 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
>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: "optim" and "nlminb"

Spencer Graves-2
a fortune?


On 10/11/2012 9:56 AM, John C Nash wrote:


<snip>


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


--
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: "optim" and "nlminb"

nserdar
I have already try "optimx" but I got this error message. How to solve it.

fn is  Linn
Function has  10  arguments
par[ 1 ]:  0   <? 0.5   <? 1     In Bounds          
par[ 2 ]:  0   <? 0.5   <? 1     In Bounds   In Bounds          
par[ 3 ]:  0   <? 0.5   <? 1     In Bounds   In Bounds   In Bounds        
par[ 4 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds        
par[ 5 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds      
par[ 6 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds      
par[ 7 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds    
par[ 8 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds    
par[ 9 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds  
par[ 10 ]:  -Inf   <? 1   <? Inf     In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds   In Bounds  
Error in optimx(init.par, Linn, gr = NULL, method = "L-BFGS-B", hessian = TRUE,  :
  Function provided is not returning a scalar number

Regards,
Serdar