eric lee wrote:
Hi,

I'm trying to get the p-value from the 'lm' regression function as a list
object.  For example, I can get r^2 from the following code by entering
summary(fm)$r.squared.  Is there a way to get the p-value?  If not, is there
a function where I can enter the f-value and degrees of freedom to get the
p-value?  Thanks.

x <- c(1,2,3,4,5,6,7,8,9,10)
y <- c(1,2,3,4,4,5,6,8,1,9)

fm <- lm(y ~ x)
str(summary(fm))

What about the following (taken from  stats:::print.summary.lm):


x <- c(1,2,3,4,5,6,7,8,9,10)
y <- c(1,2,3,4,4,5,6,8,1,9)

fm <- lm(y ~ x)

summary(fm) # for comparison only

sfm <- summary(fm)
pf(sfm$fstatistic[1], sfm$fstatistic[2], sfm$fstatistic[3],
  lower.tail = FALSE)



Thomas P.

______________________________________________
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