Medimel <medimelenglish <at> gmail.com> writes: > > Dear Sir/ Madam, > > I'm having trouble de-bugging the following - which works perfectly > well with optim or optimx - but not with mle2. > I'd be really grateful if someone could show me what is wrong. Many > thanks in advance. JSC: >
mle2 is built on mle from the stats3 package, which expects the function to be specified in terms of a set of independent parameters (e.g. gompertz2 <- function(a3,b3) { ... } There is a workaround, which could be better described in the documentation, which is to set the 'vecpar' argument to TRUE and use parnames() a parameter-names attribute on the function, as follows: library(bbmle) parnames(gompertz2) <- c("a3","b3") A <- mle2(gompertz2, vecpar=TRUE, start=list(a3=0.03,b3=0.1),data=list(data=data)) Also note that 'data' must be specified as a *named* list, as above. Your example was quite clear but not entirely reproducible -- it would have been good to provide a short example 'data' set. ______________________________________________ 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.