Hello, On 6/16/09, Stu @ AGS <s...@agstechnet.com> wrote: > Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B") : > > objective function in optim evaluates to length 6 not 1 > <skip> > > > pe <- function(c) c[1]*x1*x2^c[2]*x3^c[3] > I would suspect a matrix multiplication issue. In order to minimise your function optim expects the result of your specific function to be a scalar. Are you sure that after all the multiplications pe results in a vector of dimension 1x1? Liviu
______________________________________________ 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.