sbayesboot | R Documentation |
sbayesboot()
performs a Bayesian bootstrap of a regression model.
sbayesboot(object, reps = 1000L, seed, cluster = NULL, ...)
object |
a regression model object |
reps |
how many bootstrap replicates the user wants. Defaults to 1000 |
seed |
set an optional seed for reproducibility |
cluster |
an optional cluster for calibrating the weights |
... |
optional arguments |
The code underpinning sbayesboot()
is largely derived from
code provided by Grant McDermott and Vincent Arel-Bundock. My approach here
takes the flexibility of McDermott's model-agnostic code (along with the
ease of specifying clusters) and combines it with Arel-Bundock's
update()
approach to the actual bootstrapping. I may have screwed
something up, so feel free to point to cases where I did screw up.
sbayesboot()
takes a fitted regression model and returns a matrix
of bootstrapped coefficients (with intercept). These could be easily
converted to a data frame for ease of summary.
Grant McDermott, Vincent Arel-Bundock
M1 <- lm(mpg ~ disp + wt + hp, mtcars)
# Default options
BB1 <- sbayesboot(M1)
# Cluster bootstrap on cylinder variable
BB2 <- sbayesboot(M1, cluster=~cyl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.