Is there a way to optimize a function that has the dot-dot-dot (...) argument using optim()
Hello, ?optim has a dots argument, so just pass whatever you want after 'gr'. Something like the following. optim(-3, foo, NULL, 1, 2) Hope this helps, Rui Barradas Em 21-11-2013 22:05, Nan Wang escreveu:
Hi everyone,
If the function I am trying to optimize have the ... argument, how to pass
it to optim()?
For example, we want to minimize this very simple function:
foo <- function(a, ...) {
var=list(...)
(a-1)^2+do.call(sum,var)
}
Although the ... in this function doesn't make any difference.
Thanks,
Nan
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.