bootreg: Run Bootstrapped regression

View source: R/bootreg.R

bootregR Documentation

Run Bootstrapped regression

Description

runs repeated regressions on bootstrap samples, testing coefficients via z-distribution using bootstrapped standard errors.

Usage

bootreg(data, model, method = lm, n = 1000)

Arguments

data

a data frame

model

a fitted lme or lm - model

method

a function to use for refitting

n

number of bootstrap samples

Value

Bootstrap regression results object (brr)

Examples

R base models
x <- rnorm(100)
m <- rnorm(100)
y <- rnorm(100,0.4*x-0.6*m,2)
model <- lm(y~m*x)
brr <- bootreg(data.frame(x,m,y),model,lm)


#mixed models
x <- rnorm(50)
m <- rnorm(50)
y <- rnorm(50,x*m,2)
g <- sample(1:10,50,TRUE)
model <- lme4::lmer(y~m*x + (1|g))
brr <- bootreg(data.frame(x,m,y,g),model,lme4::lmer)


AlexHartmann00/lmmadd documentation built on Aug. 16, 2022, 8:19 a.m.