# NOT RUN {
# Bootstrap a regression model
slipper_lm(mtcars,mpg ~ cyl,B=100)
# Bootstrap a regression model with piping
mtcars %>% slipper_lm(mpg ~ cyl,B=100)
# Bootstrap residuals for a regression model
mtcars %>% slipper_lm(mpg ~ cyl,B=100,boot_resid=TRUE)
# Bootsrap confidence intervals
mtcars %>% slipper_lm(mpg ~ cyl,B=100) %>%
filter(type=="bootstrap",term=="cyl") %>%
summarize(ci_low = quantile(value,0.025),
ci_high = quantile(value,0.975))
# Bootstrap hypothesis test - here I've added one to the numerator
# and denominator because bootstrap p-values should never be zero.
boot = mtcars %>% slipper_lm(mpg ~ cyl, null_formula = mpg ~ 1,B=1000) %>%
filter(term=="cyl") %>%
summarize(num = sum(abs(value) >= abs(value[1])),
den = n(),
pval = num/den)
# }
Run the code above in your browser using DataLab