[R] retrieving p-values in lm
Patrick Kuss
Patrick.Kuss at unibas.ch
Fri Dec 9 14:19:33 CET 2005
Dear list,
I want to retrieve the p-value of a two-polynomial regression. For a
one-polynomial lm I can easily do this with:
summary(lm(b~a, data=c)[[4]][[8]].
But how do I find the final p-value in the two-polynomial regression? Under
$coefficients I don't find it
Any suggestions?
Patrick
alt <-(2260,2183,2189,1930,2435,
2000,2100,2050,2020,2470,
1700,2310,2090,1560,2060,
1790,1940,2100,2250,2010)
H <- c(0.2034,0.1845,0.2053,0.1788,0.2196,
0.2037,0.1655,0.2176,0.1844,0.2033,
0.1393,0.2019,0.1975,0.1490,0.1917,
0.2180,0.2064,0.1943,0.2139,0.1320)
X <- data.frame(alt,H)
lm.res <- summary(lm(H~alt,data=X))
lm.res
p1 <- lm.res[[4]][[8]]
p1
lm.res.2 <- summary(lm(H~alt+I(alt^2),data=X))
lm.res.2
str(lm.res.2) # where is p
p2 <- lm.res.2[[???]][[????]]
--
Patrick Kuss
PhD-student
Institute of Botany
University of Basel
Schönbeinstr. 6
CH-4056 Basel
+41 61 267 2976
More information about the R-help
mailing list