Prototype nls library for R using closures

Douglas Bates bates@stat.wisc.edu
29 Mar 1999 19:44:21 -0600


I just uploaded to CRAN a prototype nls (nonlinear least squares)
library for R.  It is far from being finished but I am asking for
this preliminary version to be installed in the src/contrib/Devel
section of CRAN so others can see the use of function closures
to emulate the behaviour of objects in languages like Java.

It will be a couple of days before the file is installed in CRAN and
has a chance to propagate to the mirrors.  The impatient can pick up a
copy at
	    ftp://verdi.stat.wisc.edu/pub/nls_0.1-1.tar.gz
It can be installed on Unix/Linux systems by expanding the tar file
and running
  R INSTALL nls
This version does not use any C code so it should be installable on
Windows if you can expand the tar file.

The nls function takes the model formula, the data, and the starting
values for the parameters and creates an nlsModel object, which is a
list of functions _and_ the environment in which they were created.
That is, it is a list of function closures that share the same
environment.  This is similar in flavor to the example in the
demos/language/scoping.R file.

All of the functions in an nlsModel object behave like accessor
methods except for setPars which sets a new value of the parameters.
Using the nlsModel object and its methods, the nls function itself
becomes trivial.

This style of programming is directly inspired by the presentation
that Robert Gentleman made on the last day of the Distributed
Statistical Computing - Vienna '99 conference.

I would like to take this opportunity to again thank our hosts; Kurt,
Fritz, and Andreas, for their kind hospitality and their generosity in
staging the conference.  I, for one, thoroughly enjoyed it.  I feel
that I learned a lot and that we got a lot done that would have been
very hard to do with e-mail connections only.

-- 
Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._