se(rnorm(n = 100, mean = 3))
data(efc)
se(efc[, 1:3])
library(lme4)
fit <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
se(fit)
# compute standard error from regression coefficient and p-value
se(list(estimate = .3, p.value = .002))
## Not run:
# # compute standard error of ICC for the linear mixed model
# icc(fit)
# se(icc(fit))
#
# # the standard error for the ICC can be computed manually in this way,
# # taking the fitted model example from above
# library(dplyr)
# dummy <- sleepstudy %>%
# # generate 100 bootstrap replicates of dataset
# bootstrap(100) %>%
# # run mixed effects regression on each bootstrap replicate
# mutate(models = lapply(.$strap, function(x) {
# lmer(Reaction ~ Days + (Days | Subject), data = x)
# })) %>%
# # compute ICC for each "bootstrapped" regression
# mutate(icc = unlist(lapply(.$models, icc)))
# # now compute SE and p-values for the bootstrapped ICC, values
# # may differ from above example due to random seed
# boot_se(dummy, icc)
# boot_p(dummy, icc)## End(Not run)
Run the code above in your browser using DataLab