add_probs.lmerMod {ciTools} | R Documentation |
Response Probabilities for Linear Mixed Models
Description
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
.
Usage
## S3 method for class 'lmerMod'
add_probs(
df,
fit,
q,
name = NULL,
yhatName = "pred",
comparison = "<",
type = "parametric",
includeRanef = TRUE,
nSims = 10000,
log_response = FALSE,
...
)
Arguments
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. |
Details
It is recommended that one perform a parametric bootstrap to
determine these probabilities. To do so, use the option type
= "boot"
.
Value
A dataframe, df
, with predictions and probabilities
attached.
See Also
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.
Examples
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 = ">")