On Feb 5, 2010, at 12:00 PM, Turchin, Michael wrote:

You should be able to access the p-value using the $coefficients variable, which is part of summary.

Try:

results <- summary(lm(speed~dist, cars))
results$coefficients

and then:

results$coefficients[x]

The "coefficients" element of the summary argument is a two dimensional structure. You might be able to extract a number this way but choosing the correct number, in this case 8, for the p-value associated with the dist parameter, might not be so obvious.

--
Best


where x is the location of particular p-value, or coefficient supplied, you want, from the results$coefficient vector.

Hope this helps,
~Michael
________________________________________
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Trafim Vanishek [rdapam...@gmail.com]
Sent: Friday, February 05, 2010 11:54 AM
To: r-help@r-project.org
Subject: [R] Extract p-value from lm for the whole model

Dear all,

I would like to ask how to extract the p-value for the whole model from
summary(lm).
This didn't help a lot summary.lm

summary(lm(speed~dist, cars))

Thanks a lot!

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.

Reply via email to