[R] Extract psuedo model matrix from nls?

Douglas Bates bates at stat.wisc.edu
Wed Apr 3 00:12:48 CEST 2002


Murray Jorgensen <maj at waikato.ac.nz> writes:

> Hi R-list,
> 
> I'd like to extract the psuedo model matrix (derivative of fitted
> values wrt the parameters) from an nls object.
> 
> Any suggestions?

The short answer is fm$m$gradient() when your fitted nls model is
called fm.

The longer answer is that the component m in a fitted nls model object
is a list of functions that share a function closure.  The function
closure contains the data and other information about the fit.  One of
those functions is called gradient.  Calling that function either
returns the precalculated gradient or, if necessary, evaluates and
returns the gradient.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list