select_model | R Documentation |
Selects best-fitting model, minimizing AIC accounting for missing values. Accounts for missing variables in two stages. Excludes missing observations from variables in base model, selects model. Excludes missing observations from variables retained in selected model. Refits model and selects model again. Then refits model to full data set. Calls -stepAIC- from MASS library
select_model(model, include = NULL, detail = 1)
model |
object of class "glm" |
include |
character vector of variables excluded from selection |
detail |
1 or 0 (default 1). Shows selection detail (1=Yes, 0=No, see trace from -stepAIC) |
"glm" object
utils::data(survey, package = "MASS")
survey2<-survey
#add some missing data
survey2$Wr.Hnd[1:5]<-NA
otemp<-glm(Sex~Wr.Hnd+NW.Hnd+Fold+Pulse+Smoke+Height, data=survey2, family=binomial)
summary(otemp)
mod1<-select_model(otemp)
summary(mod1)
mod2<-select_model(otemp, include=c("Smoke", "Pulse"))
summary(mod2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.