bootstrap_lmer: Bootstrap confidence intervals for (g)lmer models.

Description Usage Arguments Value Examples

Description

Bootstrap confidence intervals for (g)lmer models.

Usage

1
bootstrap_lmer(model, n, conf = 0.95, ...)

Arguments

model

(g)lmer model for confidence interval estimation.

n

Number of bootstrap iterations

conf

Size of confidence interval. 0.95 by default.

...

Other arguments passed to bootMer in lme4.

Value

A dataframe with confidence interval information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#Fit model
library(lme4)
library(boot)
data(sleepstudy)
data(cbpp)

fm1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy)

#Calculate 95% CIs with parametric boostrap and 100 iterations
bootstrap_lmer(fm1, n = 100, conf = 0.95, type = "parametric")

#Do the same with glmer
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)

#Calculate 95% CIs with parametric boostrap and 100 iterations
bootstrap_lmer(gm1, n = 100, conf = 0.95, type = "parametric")

LiamDBailey/MyFuncs documentation built on June 5, 2019, 5:10 p.m.