add_probs.glmerMod {ciTools}  R Documentation 
This function is one of the methods for add_probs
, and is
called automatically when add_probs
is used on a fit
of class glmerMod
. Probabilities are approximate and
determined via a simulation. This function is experimental.
## S3 method for class 'glmerMod'
add_probs(
df,
fit,
q,
name = NULL,
yhatName = "pred",
comparison = "<",
type = "boot",
includeRanef = TRUE,
nSims = 10000,
...
)
df 
A data frame of new data. 
fit 
An object of class 
q 
A double. A quantile of the response distribution. 
name 

yhatName 

comparison 
A string. If 
type 
A string. Must be 
includeRanef 
A logical. Default is 
nSims 
A positive integer. Controls the number of bootstrap
replicates if 
... 
Additional arguments. 
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.
A dataframe, df
, with predicted values and estimated
probabilities attached.
add_pi.glmerMod
for prediction intervals
of glmerMod
objects, add_ci.glmerMod
for
confidence intervals of glmerMod
objects, and
add_quantile.glmerMod
for response quantiles of
glmerMod
objects.
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_probs(df, fit, name = "p0.6", q = 0.6, nSims = 500)