[Rd] messing with ...

From: Ben Bolker <bolker_at_zoology.ufl.edu>
Date: Wed, 13 Aug 2008 11:45:34 -0400

   I'm looking for advice on manipulating parameters that are going to be passed through to another function.

   Specifically, I am working on my version of "mle", which is a wrapper for optim (among other optimizers). I would prefer not to replicate the entire argument list of optim(), so I'm using ... to pass extra arguments through.

   However:
     the starting values are specified as a list, which means that users can potentially specify them in any order (or at least that's the way it works now -- one solution to the problem I'm about to state is to insist that they specify the parameters in the same order as they are given in the arguments of the objective function).

   However, there are other arguments (lower, upper, control$parscale, control$ndeps) that should all be in the same order as the objective function definition by the time they get to optim()). I can think of a few solutions:

(1) make the user specify them all in the right order (ugh)
(2) add all of them as explicit parameters to my function
so that I can rearrange them appropriately (ugh)
(3) mess with the ... argument before it gets passed
through to optim (impossible?)
(4) capture ... as arglist <- list(...), manipulate the arguments
as necessary, then pass them along to optim as do.call("optim",arglist) (ugh but maybe the best solution?)

   any thoughts?

  thanks

   Ben Bolker



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 13 Aug 2008 - 15:53:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Aug 2008 - 17:36:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive