[R] Access Object's Objects HELP

Douglas Bates bates at stat.wisc.edu
Thu May 22 01:24:20 CEST 2003

DivineSAAM at aol.com writes:

> Dear WizaRds,
> A run of nls produces the following concise summary:
> > summary(cs.wt)
> Formula: 0 ~ wt.MM(conc, time, A1, a1, A2, a2)
> Parameters:
>     Estimate Std. Error t value Pr(>|t|)  
> A1 4.814e+02  2.240e+01  21.495   0.0296 *
> a1 7.401e-01  7.435e-02   9.956   0.0637 .
> A2 1.613e+02  1.738e+01   9.280   0.0683 .
> a2 1.770e-02  7.324e-03   2.417   0.2497  
> ------------------------------------------
> I need to access the estimates of A1,a1,A2...
> How can I do this?

Use the coef extractor function, as in

In general the best way to get information on a fitted model is to use
the extractor function like coef(object) as opposed to trying to
decide which component in the object holds the information of
interest.  In the case of objects of the nls class you really do want
to use the extractor functions because these objects have an unusual
internal structure.

> Also, I need to add a column to Parameters: giving
> the ratio of the Std. Error to Estimate. Is there a way to get summary to do this?

The "t value" is the ratio "Estimate"/"Std. Error".  Do you really
want "Std. Error"/Estimate?

> I can't find the summary implementation.

The nls package now has a namespace so the S3 methods are hidden.
You need to use
 getS3method("summary", "nls")
to see the gory details.

Douglas Bates                            bates at stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/

More information about the R-help mailing list