Boostrap with logistic regression

A quick example of bootstraping a logistic regression. Nothing special here, example could be extended to any other type of model that has a coef() method.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(boot)  
logit_test <- function(d,indices) {  
d <- d[indices,]  
fit <- glm(your ~ formula, data = d, family = "binomial")  
return(coef(fit))  
}

boot_fit <- boot(  
   data = your_data, 
   statistic = logit_test, 
   R = 1e5
)