confint.merMod | R Documentation |
Compute confidence intervals on the parameters of a *lmer()
model fit (of class"merMod"
).
## S3 method for class 'merMod'
confint(object, parm, level = 0.95,
method = c("profile", "Wald", "boot"), zeta,
nsim = 500,
boot.type = c("perc","basic","norm"),
FUN = NULL, quiet = FALSE,
oldNames = TRUE, ...)
## S3 method for class 'thpr'
confint(object, parm, level = 0.95,
zeta, non.mono.tol=1e-2,
...)
object |
a fitted [ng]lmer model or profile |
parm |
parameters for which intervals are sought. Specified by an
integer vector of positions, |
level |
confidence level |
method |
a |
zeta |
(for |
nsim |
number of simulations for parametric bootstrap intervals. |
FUN |
bootstrap function; if |
boot.type |
bootstrap confidence interval type, as described
in |
quiet |
(logical) suppress messages about computationally intensive profiling? |
oldNames |
(logical) use old-style names for variance-covariance
parameters, e.g. |
non.mono.tol |
tolerance for detecting a non-monotonic profile and warning/falling back to linear interpolation |
... |
additional parameters to be passed to
|
Depending on the method
specified, confint()
computes
confidence intervals by
"profile"
:computing a likelihood profile and finding the appropriate cutoffs based on the likelihood ratio test;
"Wald"
:approximating
the confidence intervals (of fixed-effect parameters
only; all variance-covariance parameters
CIs will be returned as NA
)
based on the estimated local curvature of the
likelihood surface;
"boot"
:performing parametric
bootstrapping with confidence intervals computed from the
bootstrap distribution according to boot.type
(see
bootMer
, boot.ci
).
a numeric table (matrix
with column and row names) of
confidence intervals; the confidence intervals are computed on the
standard deviation scale.
The default method "profile"
amounts to
confint(profile(object, which=parm, signames=oldNames, ...), level, zeta)
where the profile
method profile.merMod
does almost all the computations. Therefore it is typically
advisable to store the profile(.) result, say
in pp
, and then use confint(pp, level=*)
e.g., for
different levels.
if (interactive() || lme4_testlevel() >= 3) {
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
fm1W <- confint(fm1, method="Wald")# very fast, but not useful for "sigmas" = var-cov pars
fm1W
(fm2 <- lmer(Reaction ~ Days + (Days || Subject), sleepstudy))
(CI2 <- confint(fm2, maxpts = 8)) # method = "profile"; 8: to be much faster
if (lme4_testlevel() >= 3) {
system.time(fm1P <- confint(fm1, method="profile", ## <- default
oldNames = FALSE))
## --> ~ 2.2 seconds (2022)
set.seed(123) # (reproducibility when using bootstrap)
system.time(fm1B <- confint(fm1, method="boot", oldNames=FALSE,
.progress="txt", PBargs= list(style=3)))
## --> ~ 6.2 seconds (2022) and warning, messages
} else {
load(system.file("testdata","confint_ex.rda",package="lme4"))
}
fm1P
fm1B
} ## if interactive && testlevel>=3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.