fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
set.seed(54321)
system.time(simfe <- data.frame(t(apply(simulate(fm1, nsim = 100),
2,
function(y)
fixef(refit(fm1, y))
)
), check.names = FALSE)
)
qqmath(~ `(Intercept)` + Days, simfe, outer = TRUE,
ylab = NULL, scales = list(y = list(relation = "free")),
layout = c(1,2), aspect = 1, type = c("g", "p"))
sapply(simfe, mean)
sapply(simfe, sd)
Run the code above in your browser using DataCamp Workspace