[R] StepAIC and boxplot

David martin vilanew at gmail.com
Fri Nov 18 15:34:54 CET 2011


Hello,
I have done a stepwise analysis to determine the best model fitting my data.

data <- stepAIC( aov (Group)~ . , data=mydata)

data
 > summary(data)
                  Df  Sum Sq Mean Sq F value    Pr(>F)
`a`  1  1.9829 1.98290  11.176 0.0011824 **
`b`   1  2.6606 2.66064  14.996 0.0001967 ***
`c`   1  2.0339 2.03394  11.464 0.0010295 **
Residuals        96 17.0325 0.17742
---

 > data$anova
Stepwise Model Path
Analysis of Deviance Table

Initial Model:
as.integer(Group) ~ `a` + `b` + `c` +
     `d` + `e` + `f`

Final Model:
as.integer(Group) ~ `a` + `b` + `c`


                    Step Df   Deviance Resid. Df Resid. Dev       AIC
1                                            93   16.83679 -164.1604
2     - `d`  1 0.01387782        94   16.85067 -166.0780
3 - `e`  1 0.09713881        95   16.94781 -167.5032
4   - `f`  1 0.08471704        96   17.03252 -169.0046
 >

I would like to do a boxplot of the data so that i visualize the model. 
How can i boxplot the model ('a'+'b'+'c') directly ??

thanks,

david



More information about the R-help mailing list