Description Usage Arguments Details Value See Also Examples
View source: R/add_probs_lmer.R
This function is one of the methods of add_probs
, and is
called automatically when add_probs
is used on a fit
of class lmerMod
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
df |
A data frame of new data. |
fit |
An object of class |
q |
A real number. A quantile of the conditional response distribution. |
name |
|
yhatName |
A string. Name of the vector of predictions. |
comparison |
A character vector of length one. Must be either
|
type |
A string, either |
includeRanef |
A logical. If |
nSims |
A positive integer. If |
log_response |
A logical. Set to |
... |
Additional arguments. |
It is recommended that one perform a parametric bootstrap to
determine these probabilities. To do so, use the option type
= "boot"
.
A dataframe, df
, with predictions and probabilities
attached.
add_ci.lmerMod
for confidence intervals
for lmerMod
objects, add_pi.lmerMod
for
prediction intervals of lmerMod
objects, and
add_quantile.lmerMod
for response quantiles of
lmerMod
objects.
1 2 3 4 5 6 7 8 9 10 11 12 | dat <- lme4::sleepstudy
# Fit a random intercept model
fit <- lme4::lmer(Reaction ~ Days + (1|Subject), data = lme4::sleepstudy)
# What is the probability that a new reaction time will be less
# than 300? (given the random effects).
add_probs(dat, fit, q = 300)
# What is the probability that a new reaction time will be greater
# than 300? (ignoring the random effects).
add_probs(dat, fit, q = 300, includeRanef = FALSE, comparison = ">")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.