if(require(MASS)){
anorex.1 <- lm(Postwt ~ Prewt*Treat, data = anorexia)
selMod(anorex.1)
anorex.2 <- glm(Postwt ~ Prewt*Treat, family=gaussian,data = anorexia)
selMod(anorex.2)
anorex.3<-lm(Postwt ~ Prewt+Treat, data = anorexia)
mycomp<-selMod(list(anorex.1,anorex.2,anorex.3))
mycomp
attributes(mycomp)$models
}
Run the code above in your browser using DataLab