sbayesboot: Bootstrap a Regression Model, the Bayesian Way

View source: R/sbayesboot.R

sbayesbootR Documentation

Bootstrap a Regression Model, the Bayesian Way

Description

sbayesboot() performs a Bayesian bootstrap of a regression model.

Usage

sbayesboot(object, reps = 1000L, seed, cluster = NULL, ...)

Arguments

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

Details

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.

Value

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.

Author(s)

Grant McDermott, Vincent Arel-Bundock

Examples


M1 <- lm(mpg ~ disp + wt + hp, mtcars)

# Default options

BB1 <- sbayesboot(M1)

# Cluster bootstrap on cylinder variable

BB2 <- sbayesboot(M1, cluster=~cyl)


stevemisc documentation built on April 12, 2022, 5:06 p.m.