[R] Using optim() with a function which returns more than a scalar - alternatives?

From: Søren Højsgaard <Soren.Hojsgaard_at_agrsci.dk>
Date: Wed 15 Feb 2006 - 02:43:05 EST

I want to numerically maximize a function with optim (maximization over several arguments). optim() needs a function which returns a scalar only. However, it could be nice to be able to "take other things out" from the function as well. I'tried to create an attribute to the scalar with what I want to take out, but that attribute disappears in optim(). I looked into the code to see if it could (easily) be modified such that it could work on a function which returns e.g. a list or a vector (and then it should be maximized over the first element). But I gave up... Any suggestion will be appreciated... Best regards

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Feb 15 02:59:17 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:29 EST