# NOT RUN {
dat <- lme4::sleepstudy
# Fit a random intercept model
fit <- lme4::lmer(Reaction ~ Days + (1|Subject), data = lme4::sleepstudy)
# Using the parametric bootstrap: given the model fit, what value
# of reaction time do we expect half of new reaction times to fall
# under?
add_quantile(dat, fit, p = 0.5)
# Using the parametric method:
# as above, but we ignore the random effects.
add_quantile(dat, fit, p = 0.5, type = "parametric", includeRanef = FALSE)
# Using the simulation method: give the vector of quantiles a
# custom name.
add_quantile(dat, fit, p = 0.5, type = "sim", name = "my_quantile", nSims = 1000)
# }
Run the code above in your browser using DataLab