[R] Parameter info from nls object
David Winsemius
dwinsemius at comcast.net
Mon Nov 9 18:59:13 CET 2009
On Nov 9, 2009, at 12:30 PM, Dobrozemsky Georg wrote:
> Hi!
>
> When checking validity of a model for a large number
> of experimental data I thought it to be interesting
> to check the information provided by
> the summary method programmatically.
>
> Still I could not find out which method to
> use to get to those data.
>
> Example (not my real world data, but to show the point):
>
> [BEGIN]
>> DNase1 <- subset(DNase, Run == 1)
>> fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal),
>> DNase1)
>> summary(fm1DNase1)
>
> Formula: density ~ SSlogis(log(conc), Asym, xmid, scal)
>
> Parameters:
> Estimate Std. Error t value Pr(>|t|)
> Asym 2.34518 0.07815 30.01 2.17e-13 ***
> xmid 1.48309 0.08135 18.23 1.22e-10 ***
> scal 1.04146 0.03227 32.27 8.51e-14 ***
> ---
> Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
>
> Residual standard error: 0.01919 on 13 degrees of freedom
>
> Number of iterations to convergence: 0
> Achieved convergence tolerance: 3.302e-06
> [END]
>
> now i would like something like
>> property(fm1DNase1,'Asym','StErr')
> [1] 0.07815
>
>> property(fm1DNase1,'xmid','Pr')
> [1] 1.22e-10
Applying str to the summary object should have given you sufficient
clues. Then it is a simple matter of extracting the right component,
and then properly extracting from the matrix with the correct names:
> str(summary(fm1DNase1)$parameters)
num [1:3, 1:4] 2.3452 1.4831 1.0415 0.0782 0.0814 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:3] "Asym" "xmid" "scal"
..$ : chr [1:4] "Estimate" "Std. Error" "t value" "Pr(>|t|)"
> summary(fm1DNase1)$parameters['Asym',"Std. Error"]
[1] 0.07815395
> summary(fm1DNase1)$parameters['xmid',"Pr(>|t|)"]
[1] 1.218535e-10
>
> I hope you understand the point (and yes,
> I read manuals, tried help(), read through
> the archives), sorry if still this is trivial :P
>
> wfG
>
> George
>
> +---
> | Dr. Georg Dobrozemsky
> | Dept. of. Nuclear Medicine
> | Med. Univ. Vienna
> +---
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list