Description Usage Arguments Details Value See Also Examples
View source: R/add_quantile_lmer.R
This function is one of the methods for add_quantile
and
is called automatically when add_quantile
is applied to an
object of class lmerMod
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
df |
A data frame of new data. |
fit |
An object of class |
p |
A real number between 0 and 1. Determines the probability level of the quantiles. |
name |
|
yhatName |
A string. Determines the name of the column of predictions. |
includeRanef |
The random effects be included or not? If
|
type |
A string. Options are |
nSims |
A positive integer. Set the number of bootstrap
simulations to perform. Only applied when |
log_response |
A logical. Set to |
... |
Additional arguments. |
add_qauntile.lmerMod
may use one of two different methods
for determining quantiles: a parametric method or a parametric
bootstrap method (via lme4::simulate
). The parametric method
is the default. Only use the parametric method (type =
"parametric"
) if fit
is a random intercept model,
e.g. fit = lmer(y ~ x + (1|group))
. If your model of
interest is random slope and random intercept, use the parametric
bootstrap method (type = "boot"
).
A dataframe, df
, with predicted values and level-p
quantiles attached.
add_ci.lmerMod
for confidence intervals
for lmerMod
objects, add_pi.lmerMod
for
prediction intervals of lmerMod
objects, and
add_probs.lmerMod
for response probabilities of
lmerMod
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 | dat <- lme4::sleepstudy
# Fit a random intercept model
fit <- lme4::lmer(Reaction ~ Days + (1|Subject), data = lme4::sleepstudy)
# Using the parametric method: 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, includeRanef = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.