Skip to content

nlm question

3 messages · John Logsdon, Douglas Bates, Peter Dalgaard

#
Hello again

Is there any way (or an alternative non-linear minimiser) that arguments
to the function called in nlm can be passed in version 0.62.4?  Like (I
believe) nlmin in a well known other program or optimise in R.  Do we use
global variables?  Shurely not!

\John


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
John> Hello again Is there any way (or an alternative non-linear
  John> minimiser) that arguments to the function called in nlm can be
  John> passed in version 0.62.4?  Like (I believe) nlmin in a well
  John> known other program or optimise in R.  Do we use global
  John> variables?  Surely not!

I think the preferred answer is to use function closures.  See demo(scoping).
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
John Logsdon <j.logsdon at lancaster.ac.uk> writes:
At the end of the Description for nlm we have:

        This is a preliminary version of this function and it
        will probably change.

..which is probably the point. Adding ... arguments should be pretty
obvious (unless the names clash with any of all the *other* args!)
after a peek at the way it is done in optimize: Just replace f in

    .Internal(nlm(f, p, .....

with function(p)f(p,...)

I can't see why it shouldn't work here as well.