LFRC <feliperiehs <at> yahoo.com.br> writes: > > > Dear Ben Bolker, > > Thanks a lot for your help. > > I have two more questions: > > 1) My goal is maximize the function (> r = Y*log(comb)) but the > parameters found, minimized the function (r = Y*log(comb)). >
Oh. Oops. Just change the sign ( r = -Y*log(comb)) or set fnscale=-1 (see ?optim) > 2) What this function do? > > model2 <- function(p) { > > do.call("Model",as.list(p)) > > } > I got a little carried away, this is R Magic. mle() expects the function to be written out with a list of parameters ( func(param1,param2,param3) ), while optim and constrOptim want the function to have a single vector argument ( func(paramvec) ). model2() is a wrapper that converts a vector p into a list and passes it to the Model function. 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.