Description Usage Arguments Details Value See Also Examples
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.
1 2 3 4 5 6 7 8 9 10 11 12 |
df |
A data frame of new data. |
fit |
An object of class |
alpha |
A real number between 0 and 1. Controls the confidence level of the interval estimates. |
names |
|
yhatName |
|
type |
A string. Must be |
includeRanef |
A logical. Default is |
nSims |
A positive integer. Controls the number of bootstrap replicates. |
... |
Additional arguments. |
Prediction intervals are approximate and determined by simulation
through the simulate function distributed with lme4.
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, upper and lower
prediction bounds attached.
add_ci.glmerMod for confidence intervals
of glmerMod objects, add_probs.glmerMod for
conditional probabilities of glmerMod objects, and
add_quantile.glmerMod for response quantiles of
glmerMod objects.
1 2 3 4 5 6 7 8 | 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+x|f), data=df, family = "poisson")
add_pi(df, fit, names = c("LPB", "UPB"), nSims = 500)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.