adschai at optonline.net
2007-Jun-13 02:04 UTC
[R] specify constraints in maximum likelihood
Hi,I know only mle function but it seems that in mle one can only specify the bound of the unknowns forming the likelihood function. But I would like to specify something like, a = 2b or a <= 2b where 'a' and 'b' could be my parameters in the likelihood function. Any help would be really appreciated. Thank you!- adschai [[alternative HTML version deleted]]
<adschai <at> optonline.net> writes:> > Hi,I know only mle function but it seems that in mle one can only specify thebound of the unknowns forming the> likelihood function. But I would like to specify something like, a = 2b or a<= 2b where 'a' and 'b' could be my> parameters in the likelihood function. Any help would be really appreciated.Thank you!- adschai> >Something like a=2b (equality constraints with a simple form) should be easy, just reparameterize your function. e.g. if you have minuslogl equal to f(a,b,c) then define a new function f2 <- function(a,c) { b <- a/2 f(a,b,c) } For a<=2b reparameterize in terms of d=a-2b : f2 <- function(a,c,d) { b <- (a-d)/2 f(a,b,c) } and impose the constraint (e.g. with L-BFGS-B) of d<=0. Actually, the second one (linear inequality constraints) can also be done with constrOptim. More complex (nonlinear) constraints have to be done with Lagrange multipliers or penalty terms ( http://www.zoo.ufl.edu/bolker/emdbook/chap7A.pdf has some general description, at a very basic level )