Cwomen1 <- read.table("c:/temp/BFox.txt",header=F,skip=1) names(Cwomen1) <- c("year","participation","tfr","menWages","womenWages","debt","parttime") Cwomen1$tfr <- Cwomen1$tfr*(Cwomen1$year != 1973) +1931*(Cwomen1$year == 1973) # use the leaps package to perform model selection library(leaps) ModFit1.SubFit <- regsubsets(participation ~ tfr +menWages +womenWages +debt +parttime +year, data=Cwomen1, nbest=3) # use the car package to make interesting plots of the results # from the regsubsets function library(car) subsets(ModFit1.SubFit,statistic="bic") subsets(ModFit1.SubFit,statistic="adjr2") subsets(ModFit1.SubFit,statistic="bic",min.size=2)