# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (formula, data = NULL, Lconfint = FALSE, REML = TRUE,
...)
{
vars <- all.vars(formula)
formulaaov <- as.formula(paste(vars[1], "~", vars[2]))
ANOV <- aov(formulaaov, data, ...)
.ANOV <- summary(ANOV)
cat("-------------------------------")
cat("\n", gettext("ANOVA table", domain = "R-RcmdrPlugin.TeachStat"),
":\n", sep = "")
print(.ANOV)
cat("\n-------------------------------\n")
.sol <- lme4::lmer(formula, data = data, REML = REML, ...)
.varcor <- lme4::VarCorr(.sol)
.sighat2 <- unname(attr(.varcor, "sc"))^2
.sighatalph2 <- unname(attr(.varcor[[vars[2]]], "stddev"))^2
.prop <- .sighatalph2/(.sighatalph2 + .sighat2)
estim <- c(.sighat2, .sighatalph2, .prop)
names(estim) <- c("var (Error)", "var (Effect)", "% var (Effect)")
cat("\n", gettext("Components of Variance", domain = "R-RcmdrPlugin.TeachStat"),
" (", lme4::methTitle(.sol@devcomp$dims), "):\n", sep = "")
print(estim)
if (Lconfint) {
cat("\n", gettext("Confidence intervals", domain = "R-RcmdrPlugin.TeachStat"),
":\n", sep = "")
print(confint(.sol, oldNames = FALSE))
}
return(invisible(list(model = .sol, estimation = estim)))
}
# }
Run the code above in your browser using DataLab