On Nov 9, 2009, at 12:59 PM, David Winsemius wrote:
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:
I should probably admit that I have gotten into bad habits over the
couple of years I have used R, and that the "approved" method is to
use the extractor function, coef (which is one of the links from the
page regarding either nls or summary.nls (but not from just the
summary help page.)
> coef(summary(fm1DNase1))
Estimate Std. Error t value Pr(>|t|)
Asym 2.345180 0.07815395 30.00719 2.165502e-13
xmid 1.483090 0.08135321 18.23026 1.218535e-10
scal 1.041455 0.03227080 32.27236 8.506915e-14
> coef(fm1DNase1)
Asym xmid scal
2.345180 1.483090 1.041455
> 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
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@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.