# [R] Any function\method to use automatically Final Model after bootstrapping using boot.stepAIC()

aajit75 aajit75 at yahoo.co.in
Tue Nov 29 13:50:01 CET 2011

```Hi List,
Being new to R, I am trying to apply boot.stepAIC() for Model selection by
bootstrapping the stepAIC() procedure. I had gone through the discussion in
various thread on the variable selection methods. Understood the pros and
cons of various method, also going through the regression modelling
strategies in rms.
I want to read Final model or Formula or list of variables automatically
after boot.stepAIC().

n <- 200
x1 <- runif(n, -3, 3)
x2 <- runif(n, -3, 3)
x3 <- runif(n, -3, 3)
x4 <- runif(n, -3, 3)
x5 <- factor(sample(letters[1:2], n, rep = TRUE))
eta <- 0.1 + 1.6 * x1 - 2.5 * as.numeric(as.character(x5) == levels(x5)[1])
y1 <- rbinom(n, 1, plogis(eta))

data <- data.frame(y1,x1, x2, x3, x4, x5)
glmFit1 <- glm(y1 ~ x1 + x2 + x3 + x4 + x5, family = binomial, data = data)
bglmfit <- boot.stepAIC(glmFit1, data, B = 50)
bglmfit
In the summary of Bootstrapping the 'stepAIC()' procedure, Following
information is listed:
Initial Model:
y1 ~ x1 + x2 + x3 + x4 + x5
Final Model:
y1 ~ x1 + x5
Is there any function or method for using Final Model by Bootstrapping the
'stepAIC()' procedure, like OrigstepAIC model as shown below.
n <- 200
x1 <- runif(n, -3, 3)
x5 <- factor(sample(letters[1:2], n, rep = TRUE))
eta <- 0.1 + 1.6 * x1 - 2.5 * as.numeric(as.character(x5) == levels(x5)[1])

data1 <- data.frame(x1, x5)
data1\$probscore <- predict(bglmfit\$OrigStepAIC , data1)
Is there any way to read the variables or formula in the Final Model.