data(zprostate)
train<-(zprostate[zprostate[,10],])[,-10]
#Best subset using AIC
bestglm(train, IC="AIC")
#Best subset using BIC
bestglm(train, IC="BIC")
#Best subset using EBIC
bestglm(train, IC="BICg")
#Best subset using BICg with g=0.5 (tuning parameter)
bestglm(train, IC="BICg", t=0.5)
#Best subset using BICq. Note BICq with q=0.25 is default.
bestglm(train, IC="BICq")
#Best subset using BICq with q=0.5 (equivalent to BIC)
bestglm(train, IC="BICq", t=0.5)
#Remark: set seed since CV depends on it
set.seed(123321123)
#Best subset using 10-fold CV. Default when IC="CV"
bestglm(train, IC="CV")
#Best subset using 5-fold adjusted CV (Davison & Hartigan algorithm)
bestglm(train, IC="CV", CVArgs=list(Method="DH", K=5, REP=1))
#Best subset using delete-d CV, with d=5 and 100 replications
bestglm(train, IC="CV", CVArgs=list(Method="d", K=5, REP=100))
#Best subset, logistic regression
data(SAheart)
bestglm(SAheart, IC="BIC", family=binomial)
#Best subset, factor variables with more than 2 levels
data(AirQuality)
#full regression
bestglm(AirQuality, IC="BICq", t=1)
#subset
bestglm(AirQuality, IC="BICq")
Run the code above in your browser using DataLab