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
stopifnot(all.equal(tolerance = 5e-6, signif(unname(CI2), 7),
array(c(15.25847, 3.964157, 22.88062, 237.5732, 7.33431,
37.78184, 8.768238, 28.78768, 265.2383, 13.60057),
dim = c(5L, 2L))))
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
Run the code above in your browser using DataLab