add_quantile.glmerMod {ciTools}  R Documentation 
Response Quantiles for Generalized Linear Mixed Model Predictions
Description
This function is one of the methods for add_pi
, and is
called automatically when add_pi
is used on a fit
of
class glmerMod
. This function is experimental.
Usage
## S3 method for class 'glmerMod'
add_quantile(
df,
fit,
p,
name = NULL,
yhatName = "pred",
type = "boot",
includeRanef = TRUE,
nSims = 10000,
...
)
Arguments
df 
A data frame of new data. 
fit 
An object of class 
p 
A real number between 0 and 1. Sets the probability level of the quantiles. 
name 

yhatName 

type 
A string. Must be 
includeRanef 
A logical. Default is 
nSims 
A positive integer. Controls the number of bootstrap replicates. 
... 
Additional arguments. 
Details
If IncludeRanef
is False, random slopes and intercepts are set to 0. Unlike in
'lmer' fits, settings random effects to 0 does not mean they are marginalized out. Consider
generalized estimating equations if this is desired.
Value
A dataframe, df
, with predicted values and quantiles attached.
See Also
add_pi.glmerMod
for prediction intervals
of glmerMod
objects, add_probs.glmerMod
for
conditional probabilities of glmerMod
objects, and
add_ci.glmerMod
for confidence intervals of
glmerMod
objects.
Examples
n < 300
x < runif(n)
f < factor(sample(1:5, size = n, replace = TRUE))
y < rpois(n, lambda = exp(1  0.05 * x * as.numeric(f) + 2 * as.numeric(f)))
df < data.frame(x = x, f = f, y = y)
fit < lme4::glmer(y ~ (1+xf), data=df, family = "poisson")
add_quantile(df, fit, name = "quant0.6", p = 0.6, nSims = 500)