Plat, H.J. <H.J.Plat <at> uva.nl> writes: > There is lots of information about maximum likelihood estimation in R. > However, I didn't came across anything about maximum likelihood > with constraints. > For example, estimation of parameters k(1) to k(20) with > maximum likelihood, where sum(k(i)) = 0.
If the individual parameters don't need to be constrained, then this is easy to do by estimating parameters k(1) to k(19) and setting k(20) to -sum_{i=1}^19 k(i). e.g. something like objfun <- function(k) { ## k is a vector parameters 1 to 19 kvec <- c(k,-sum(k)) ### ... compute and return negative log-likelihood based on kvec ... } optim(fn=objfun,par=[starting values]) If you need "box constraints" (individual parameters independently bounded above and below) you can use method="L-BFGS-B" in optim. Ben Bolker ______________________________________________ R-help@r-project.org 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.