[R] How to assign the p value from >anova to a variable ?

From: Gao Fay <statsfay_at_hotmail.com>
Date: Tue 22 Nov 2005 - 07:42:22 EST


Hi ,

If I need to assign the p-value from >anova(lm(y~x1*x2)) to a variable temp. How can I do that?
In other words, I need to let temp<-1.228e-07. I ever tried to use temp<-anova(lm(y~x1*x2))$Respone["x1:x2","Pr(>F)"], but it doesn't work. The result is like:
>anova(lm(y~x1*x2))
Analysis of Variance Table

Response: y

           Df Sum Sq Mean Sq  F value    Pr(>F)    
x1      1 0.1009  0.1009   8.7183   0.01835 *  
x2       1 0.5983  0.5983  51.6845 9.343e-05 ***
x1:x2 1 3.4940 3.4940 301.8363 1.228e-07 *** Residuals 8 0.0926 0.0116

Any idea is appreiciated, thanks a lot!
Fay



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Nov 22 07:52:32 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:15 EST