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

Gao Fay statsfay at hotmail.com
Mon Nov 21 21:42:22 CET 2005


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




More information about the R-help mailing list