[R] constrainOptim

Ravi Varadhan rvaradhan at jhmi.edu
Wed Jan 28 18:07:14 CET 2009


For simple box constraints, i.e. lower and upper limits directly on the parameters themselves, you don't need ConstrOptim.  You can get the job done with the "L-BFGS-B" algorithm in optim() or using nlminb() or using the spg() function in the BB package.  In this case the feasible region is a hyper-rectangle (could be infinite in some dimensions).

ConstrOptim() is useful when you have more general linear inequality constraints, i.e. constraints on linear combinations of parameters. In this case the feasible region is a convex polytope.  

Best,
Ravi.

____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu


----- Original Message -----
From: June Wong <neptune545 at hotmail.com>
Date: Wednesday, January 28, 2009 11:57 am
Subject: [R] constrainOptim
To: r-help at r-project.org


>  Dear R helpers
>   
>  I have a question regarding the constrainOptim. 
>  I'm coding the nested logit and would like to set a bound of rho to 
> (0,1] as an extreme value distribution where rho = exp(lambda)/1+exp(lambda)
>  I wonder if I can do that directly in optim (say rho > 0 & <= 1) or 
> need to use constrainOptim
>  I read the help but still don't know how to set ui and ci
>   
>  Thanks,
>  June
>  
>  _________________________________________________________________
>  
>  
>  	[[alternative HTML version deleted]]
>  
>  ______________________________________________
>  R-help at r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list