[R] constrOptim

Thomas Lumley tlumley at u.washington.edu
Thu Aug 2 17:27:07 CEST 2007

On Wed, 1 Aug 2007, Joanne Lee wrote:
> The constraints on the optimization problem are:
> 1 - components of potentialargmin must add to 1.
> 2 - each potentialargmin component must be (weakly) positive and
> (weakly) less than 1.
> 3 - potentialargmin %*% c(1,2,3,4,5,6,7,8,9) = 4.5

constrOptim() is not good at equality constraints, so constraints 1 and 3 
would be better expressed by reparametrization.  There is no need to 
constrain the parameters to be positive as the function already goes 
infinite at zero.  Finally, if the parameters are non-negative there is no 
need to constrain them to be <=1, as this is implied by the first 

It might be interesting to find out if some automated Lagrange-multiplier 
approach could be built into constrOptim() for equality constraints, but 
it is not a high enough priority that I am likely to do it.


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list