After MANOVA: follow-ups, factors and covariates
Follow up a joint result without overclaiming, add covariates and factors, and notice when a sample is too small for the number of outcomes.
What runs in CodeSplash
- STAT154Wilks lambda MANOVA test Runs in CodeSplash
- STAT155Pillai trace MANOVA test Runs in CodeSplash
- MANOVA / MANCOVA Verified in Python and R
You will be able to
- Read follow-up ANOVAs with Holm-adjusted p-values and canonical correlations
- Fit and interpret a MANCOVA with pre-test covariates
- Judge whether residual degrees of freedom can support the number of outcomes
Read first
A joint result is a starting point
ReadMANOVA says the outcomes differ somewhere across the groups. The next question is where. CodeSplash offers two routes:
- Univariate follow-up ANOVAs: one F test per outcome and term, with Holm-adjusted p-values inside each term.
- Canonical dimensionsCanonical discriminant analysisThe combinations of the outcomes along which groups separate most, in order of strength.: the weighted combinations of outcomes that best separate the groups, with their correlations.
They answer different questions. A follow-up ANOVA looks at one outcome and ignores the others. A canonical dimension shows the direction that drives the joint test.
Predict the follow-ups
PredictPredict first
Many textbooks say that a significant MANOVA "protects" the univariate ANOVAs that follow, so they need no adjustment.
Is that claim sound?
Reveal
No. Protection only holds if the joint null is true for every outcome. If one outcome truly differs, MANOVA rejects, and the others then go untested at an unadjusted level. That is why CodeSplash reports Holm-adjusted follow-ups.
Add covariates: MANCOVA
In the appA reading study compares three teaching methods on three post-tests, with two pre-tests as Covariates.
V = 0.55, F(6, 120) = 7.50, p < .001, partial η² = .27
- V
- 0.5456
- F
- 7.504
- df1
- 6
- df2
- 120
- p
- < .001
Effect size
- Multivariate partial η² 0.2728 · large
Plots
View data
| group | kind | label | 95% radius of the mean | Can1 (r = 0.61) | Can2 (r = 0.42) |
|---|---|---|---|---|---|
| Basal | point | — | −1.843 | −0.1761 | |
| Basal | point | — | −0.3020 | −0.7869 | |
| Basal | point | — | −2.072 | −0.4998 | |
| Basal | point | — | −0.4601 | −0.5400 | |
| Basal | point | — | 1.328 | 0.3046 | |
| Basal | point | — | 0.6937 | 0.2085 | |
| Basal | point | — | 0.7591 | −1.482 | |
| Basal | point | — | −1.830 | 0.1307 | |
| Basal | point | — | −0.2802 | 0.0858 | |
| Basal | point | — | −0.4074 | 0.3351 | |
| Basal | point | — | 0.3757 | −1.818 | |
| Basal | point | — | −2.032 | 0.0684 | |
| Basal | point | — | −1.636 | 0.7111 | |
| Basal | point | — | 0.3503 | 0.4409 | |
| Basal | point | — | −1.685 | −0.4230 | |
| Basal | point | — | 1.399 | 0.8753 | |
| Basal | point | — | −2.789 | −0.0374 | |
| Basal | point | — | −1.737 | 0.1380 | |
| Basal | point | — | −2.019 | 0.3752 | |
| Basal | point | — | −3.102 | 0.1974 | |
| Basal | point | — | −1.441 | −0.1447 | |
| Basal | point | — | −0.3329 | 0.6468 | |
| DRTA | point | — | −0.9452 | −0.0128 | |
| DRTA | point | — | −1.292 | 0.4786 | |
| DRTA | point | — | 0.5828 | −2.367 | |
| DRTA | point | — | −1.310 | 0.7830 | |
| DRTA | point | — | 1.873 | −1.302 | |
| DRTA | point | — | 1.767 | −1.616 | |
| DRTA | point | — | 1.420 | 0.3119 | |
| DRTA | point | — | 1.319 | −1.697 | |
| DRTA | point | — | 1.433 | −0.8174 | |
| DRTA | point | — | 0.6755 | −0.9232 | |
| DRTA | point | — | −0.1821 | −0.5182 | |
| DRTA | point | — | −1.948 | −1.926 | |
| DRTA | point | — | 0.7954 | −0.6545 | |
| DRTA | point | — | 0.0468 | −0.1945 | |
| DRTA | point | — | −0.1567 | 0.0954 | |
| DRTA | point | — | 2.033 | 0.9715 | |
| DRTA | point | — | 1.328 | −1.131 | |
| DRTA | point | — | 0.3012 | −0.6932 | |
| DRTA | point | — | 0.8608 | −0.9087 | |
| DRTA | point | — | 0.1304 | 0.6830 | |
| DRTA | point | — | 0.5047 | 0.4530 | |
| DRTA | point | — | 1.173 | −1.144 | |
| Strat | point | — | 2.729 | 1.072 | |
| Strat | point | — | −0.8071 | 1.388 | |
| Strat | point | — | −0.4110 | 2.030 | |
| Strat | point | — | −1.908 | 0.0781 | |
| Strat | point | — | −0.9525 | 1.941 | |
| Strat | point | — | −0.4910 | −0.5424 | |
| Strat | point | — | 1.786 | −0.4840 | |
| Strat | point | — | 3.512 | 0.3558 | |
| Strat | point | — | 2.627 | 0.4994 | |
| Strat | point | — | 0.8481 | 1.657 | |
| Strat | point | — | −0.1912 | 1.788 | |
| Strat | point | — | 0.8917 | 0.5298 | |
| Strat | point | — | −1.565 | 2.718 | |
| Strat | point | — | 0.0014 | −3.024 | |
| Strat | point | — | 0.5447 | 1.021 | |
| Strat | point | — | 0.5265 | 2.762 |
First 60 of 72 rows.
View data
| D² of each row |
|---|
| 1.994 |
| 6.603 |
| 1.125 |
| 0.7511 |
| 3.295 |
| 1.456 |
| 1.296 |
| 3.501 |
| 2.617 |
| 1.496 |
| 3.173 |
| 1.802 |
| 2.518 |
| 2.999 |
| 0.4335 |
| 3.314 |
| 1.963 |
| 1.562 |
| 1.045 |
| 2.630 |
| 5.436 |
| 5.154 |
| 6.426 |
| 2.458 |
| 2.418 |
| 5.475 |
| 1.024 |
| 0.2672 |
| 1.510 |
| 2.743 |
| 0.0509 |
| 1.117 |
| 2.128 |
| 7.049 |
| 3.101 |
| 2.370 |
| 2.296 |
| 6.351 |
| 1.795 |
| 1.362 |
| 0.8776 |
| 1.245 |
| 1.141 |
| 0.6053 |
| 3.812 |
| 2.269 |
| 1.058 |
| 4.956 |
| 2.655 |
| 2.688 |
| 1.781 |
| 3.617 |
| 1.722 |
| 1.333 |
| 3.232 |
| 1.198 |
| 4.343 |
| 13.586 |
| 1.703 |
| 6.697 |
First 60 of 66 rows.
Assumptions
- Multivariate normality of residuals — Mardia skewness χ²(10) = 12.43, p = .257; kurtosis z = 0.08, p = .939.
- Equal covariance matrices — Box's M χ²(12) = 14.36, p = .278 across 3 cells (judged at α = 0.001).
- Enough residual df — 61 residual df for 3 outcomes.
Multivariate tests (Type II)
| Term | Test | Statistic | Approx. F | df1 | df2 | p | Partial η² |
|---|---|---|---|---|---|---|---|
| group | Pillai's trace | 0.5456 | 7.504 | 6 | 120 | < .001 | 0.2728 |
| group | Wilks' lambda | 0.5198 | 7.611 | 6 | 118 | < .001 | 0.2790 |
| group | Hotelling–Lawley trace | 0.7978 | 7.712 | 6 | 116 | < .001 | 0.2852 |
| group | Roy's largest root | 0.5811 | 11.623 | 3 | 60 | < .001 | 0.3675 |
| pretest1 | Pillai's trace | 0.4654 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Wilks' lambda | 0.5346 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Hotelling–Lawley trace | 0.8704 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Roy's largest root | 0.8704 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest2 | Pillai's trace | 0.1275 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Wilks' lambda | 0.8725 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Hotelling–Lawley trace | 0.1461 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Roy's largest root | 0.1461 | 2.873 | 3 | 59 | .044 | 0.1275 |
Univariate follow-up ANOVAs
| Outcome | Term | F | df1 | df2 | p | p (Holm) | Partial η² |
|---|---|---|---|---|---|---|---|
| post1 | group | 12.658 | 2 | 61 | < .001 | < .001 | 0.2933 |
| post2 | group | 9.739 | 2 | 61 | < .001 | < .001 | 0.2420 |
| post3 | group | 4.497 | 2 | 61 | .015 | .015 | 0.1285 |
| post1 | pretest1 | 35.481 | 1 | 61 | < .001 | < .001 | 0.3678 |
| post2 | pretest1 | 0.8551 | 1 | 61 | .359 | .718 | 0.0138 |
| post3 | pretest1 | 0.2985 | 1 | 61 | .587 | .718 | 0.0049 |
| post1 | pretest2 | 3.576 | 1 | 61 | .063 | .190 | 0.0554 |
| post2 | pretest2 | 2.887 | 1 | 61 | .094 | .190 | 0.0452 |
| post3 | pretest2 | 3.066 | 1 | 61 | .085 | .190 | 0.0479 |
Means by group
| group | n | post1 | post2 | post3 |
|---|---|---|---|---|
| Basal | 22 | 6.682 | 5.545 | 41.045 |
| DRTA | 22 | 9.773 | 6.227 | 46.727 |
| Strat | 22 | 7.773 | 8.364 | 44.273 |
Canonical dimensions of group
| Dimension | Eigenvalue | Canonical r | Share of the effect | Structure: post1 | Structure: post2 | Structure: post3 |
|---|---|---|---|---|---|---|
| 1 | 0.5811 | 0.6063 | 0.7284 | 0.8426 | 0.5768 | 0.4691 |
| 2 | 0.2167 | 0.4220 | 0.2716 | −0.6476 | 0.7186 | −0.3486 |
- Type II sums of squares and cross-products with sum-to-zero contrasts (car::Manova); F approximations as in R's summary.manova (Rao's F for Wilks). Roy's F is an upper bound, so its p-value is optimistic.
The exact R script · R R version 4.5.1 (2025-06-13)
# MANOVA / MANCOVA
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method multivariate.manova 1.0.1 · spec 05996be0622cb7cf
# Dataset: mv_baumann (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr)
# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/mv_baumann.parquet", col_select = c("post1", "post2", "post3", "group", "pretest1", "pretest2")))
n_input <- nrow(df)
df[["group"]] <- factor(df[["group"]], levels = c("Basal", "DRTA", "Strat")) # stored level order
df <- df[stats::complete.cases(df[c("post1", "post2", "post3", "group", "pretest1", "pretest2")]), , drop = FALSE] # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("post1", "post2", "post3", "group", "pretest1", "pretest2")) # infinite values stop the run (registry/errors.yaml)
# %% Helpers
magnitude <- function(x, cuts, labels = c("negligible", "small", "medium", "large")) {
# Benchmark label for an effect size (rule set named in the result)
if (is.null(x) || !is.finite(x)) return("undetermined")
labels[findInterval(abs(x), cuts) + 1]
}
# %% Model
# car::Manova(lm(cbind(...) ~ factors + covariates), type = "II" | "III") with sum-to-zero contrasts.
outcomes <- c("post1", "post2", "post3")
factor_cols <- c("group")
covariate_cols <- c("pretest1", "pretest2")
test <- "pillai" # pillai | wilks | hotelling_lawley | roy
ss_type <- "II"
interactions <- TRUE && length(factor_cols) > 1
univariate <- TRUE
conf <- 0.95
alpha <- 1 - conf
Y <- as.matrix(df[outcomes])
storage.mode(Y) <- "double"
n <- nrow(Y)
dims <- ncol(Y)
factors <- lapply(factor_cols, function(f) {
if (nlevels(df[[f]]) < 2) cs_error("CS_E_TOO_FEW_GROUPS", column = f, min = 2, k = nlevels(df[[f]]))
list(name = f, codes = as.integer(df[[f]]) - 1L, L = nlevels(df[[f]]))
})
for (j in seq_along(outcomes)) {
# a constant outcome makes the residual SSCP matrix singular
if (length(unique(Y[, j])) < 2) cs_error("CS_E_CONSTANT", column = outcomes[j])
}
covs <- lapply(covariate_cols, function(cv) list(name = cv, values = as.numeric(df[[cv]])))
fit <- cs_mv_mlm_terms(Y, factors, covs, interactions, ss_type)
E <- fit$E
df_res <- fit$df_res
NAMES <- c(pillai = "Pillai's trace", wilks = "Wilks' lambda", hotelling_lawley = "Hotelling–Lawley trace", roy = "Roy's largest root")
SYMBOL <- c(pillai = "V", wilks = "Λ", hotelling_lawley = "T", roy = "Θ")
results <- lapply(fit$terms, function(t) list(term = t, tests = cs_mv_tests(t$H, E, t$q, df_res)))
head_term <- results[[1]]$term
lead <- results[[1]]$tests[[test]]
# %% Univariate follow-ups
uni_rows <- list()
if (univariate) {
for (r in results) {
t <- r$term
rows <- lapply(seq_len(dims), function(j) {
h <- t$H[j, j]
e <- E[j, j]
fj <- (h / t$q) / (e / df_res)
list(outcome = outcomes[j], term = t$name, f = fj, df1 = t$q, df2 = df_res,
p = stats::pf(fj, t$q, df_res, lower.tail = FALSE), eta_p = h / (h + e))
})
holm <- cs_p_adjust(vapply(rows, function(x) x$p, 0), "holm")
for (j in seq_along(rows)) rows[[j]]$p_holm <- holm[j]
uni_rows <- c(uni_rows, rows)
}
}
# %% Canonical discriminant dimensions of the first factor
can <- cs_mv_canonical(head_term$H, E, df_res, Y)
s_head <- min(dims, head_term$q)
# %% Assumptions
assumptions <- list()
X <- fit$X
resid <- qr.resid(qr(X), Y)
mardia <- if (n > dims + 1) cs_mv_mardia(resid) else NULL
if (is.null(mardia)) {
assumptions[[1]] <- list(key = "mv_normality", label = "Multivariate normality of residuals", status = "info", detail = "Mardia's tests need more rows than outcomes + 1.")
} else {
ok <- mardia$skew_p >= 0.05 && mardia$kurt_p >= 0.05
status <- if (ok) "pass" else if (df_res >= 50) "info" else "warn"
assumptions[[1]] <- list(key = "mv_normality", label = "Multivariate normality of residuals", status = status, statistic = mardia$skew, p = min(mardia$skew_p, mardia$kurt_p),
detail = paste0(sprintf("Mardia skewness χ²(%.0f) = %.2f, %s; kurtosis z = %.2f, %s", mardia$skew_df, mardia$skew, cs_fmt_p(mardia$skew_p), mardia$kurt_z, cs_fmt_p(mardia$kurt_p)),
if (!ok) (if (status == "warn") ". Pillai's trace is the most robust statistic." else "; with this many residual df the tests are fairly robust.") else "."))
}
cells <- interaction(df[factor_cols], drop = TRUE)
cell_groups <- lapply(levels(cells), function(lv) resid[cells == lv, , drop = FALSE])
box <- if (length(cell_groups) > 1 && min(vapply(cell_groups, nrow, 0L)) > dims) cs_mv_box_m(cell_groups) else NULL
if (is.null(box)) {
assumptions[[length(assumptions) + 1]] <- list(key = "equal_covariance", label = "Equal covariance matrices", status = "info",
detail = paste0("Box's M needs every factor cell larger than the number of outcomes; ",
if (test == "pillai") "Pillai's trace is the safest statistic." else "prefer Pillai's trace."))
} else {
status <- if (box$p < 0.001) "warn" else "pass"
detail <- sprintf("Box's M χ²(%.0f) = %.2f, %s across %d cells", box$df, box$chisq, cs_fmt_p(box$p), length(cell_groups))
detail <- paste0(detail, if (status == "warn") (if (test == "pillai") "; Pillai's trace is the most robust choice." else "; switch to Pillai's trace, the most robust statistic.") else " (judged at α = 0.001).")
assumptions[[length(assumptions) + 1]] <- list(key = "equal_covariance", label = "Equal covariance matrices", status = status, statistic = box$chisq, p = box$p, detail = detail)
}
status <- if (df_res < dims + 5) "warn" else "pass"
assumptions[[length(assumptions) + 1]] <- list(key = "sample_size", label = "Enough residual df", status = status,
detail = paste0(sprintf("%d residual df for %d outcomes", as.integer(df_res), dims), if (status == "warn") "; estimates are unstable." else "."))
# %% Result
size <- magnitude(lead$eta, c(0.01, 0.06, 0.14))
p <- lead$p
adj <- if (length(covariate_cols)) paste0(" adjusting for ", paste(covariate_cols, collapse = ", ")) else ""
kind <- if (length(covariate_cols)) "MANCOVA" else "MANOVA"
significance <- if (p < alpha) sprintf("The outcomes jointly differ across %s (%s).", head_term$name, cs_fmt_p(p)) else
sprintf("The data are compatible with equal mean vectors across %s (%s).", head_term$name, cs_fmt_p(p))
summary <- sprintf("%s of %s%s with %s (Type %s). %s Multivariate partial η² = %.2f (%s).", kind, paste(outcomes, collapse = ", "), adj, NAMES[[test]], ss_type, significance, lead$eta, size)
if (length(results) > 1) {
others <- vapply(results[-1], function(r) sprintf("%s (%s)", r$term$name, cs_fmt_p(r$tests[[test]]$p)), "")
summary <- paste0(summary, " Other terms: ", paste(others, collapse = "; "), ".")
}
if (univariate) {
n_sig <- sum(vapply(uni_rows, function(r) r$term == head_term$name && r$p_holm < alpha, logical(1)))
summary <- paste(summary, sprintf("Univariate follow-ups: %d of %d outcomes differ across %s (Holm).", n_sig, dims, head_term$name))
}
values <- list(stat = lead$stat, f = lead$f, df1 = lead$df1, df2 = lead$df2, p = p, eta_p = lead$eta,
n = n, dims = dims, df_res = df_res, k_terms = length(results),
mardia_skew_p = if (is.null(mardia)) NULL else mardia$skew_p, mardia_kurt_p = if (is.null(mardia)) NULL else mardia$kurt_p,
box_m_p = if (is.null(box)) NULL else box$p)
mv_rows <- list()
for (r in results) {
nm <- r$term$name
for (key in c("pillai", "wilks", "hotelling_lawley", "roy")) {
x <- r$tests[[key]]
values[[sprintf("%s[%s]", key, nm)]] <- x$stat
values[[sprintf("%s_f[%s]", key, nm)]] <- x$f
values[[sprintf("%s_df1[%s]", key, nm)]] <- x$df1
values[[sprintf("%s_df2[%s]", key, nm)]] <- x$df2
values[[sprintf("%s_p[%s]", key, nm)]] <- x$p
mv_rows[[length(mv_rows) + 1]] <- list(term = nm, test = NAMES[[key]], stat = x$stat, f = x$f, df1 = x$df1, df2 = x$df2, p = x$p, eta_p = x$eta)
}
values[[sprintf("eta_p[%s]", nm)]] <- r$tests[[test]]$eta
}
for (r in uni_rows) {
k <- sprintf("%s|%s", r$outcome, r$term)
values[[sprintf("uni_f[%s]", k)]] <- r$f
values[[sprintf("uni_p[%s]", k)]] <- r$p
values[[sprintf("uni_p_holm[%s]", k)]] <- r$p_holm
values[[sprintf("uni_eta_p[%s]", k)]] <- r$eta_p
}
for (i in seq_len(s_head)) values[[sprintf("can_corr[%d]", i)]] <- can$can_corr[i]
values$missing_share <- if (n_input > 0) n_dropped / n_input else 0
values$max_interaction_order <- if (interactions) length(factor_cols) else 1L
tables <- list(list(
key = "multivariate", title = sprintf("Multivariate tests (Type %s)", ss_type),
columns = list(list(key = "term", label = "Term", type = "string"), list(key = "test", label = "Test", type = "string"),
list(key = "stat", label = "Statistic", type = "number"), list(key = "f", label = "Approx. F", type = "number"),
list(key = "df1", label = "df1", type = "number"), list(key = "df2", label = "df2", type = "number"),
list(key = "p", label = "p", type = "pvalue"), list(key = "eta_p", label = "Partial η²", type = "number")),
rows = mv_rows
))
if (univariate) {
tables[[length(tables) + 1]] <- list(
key = "univariate", title = "Univariate follow-up ANOVAs",
columns = list(list(key = "outcome", label = "Outcome", type = "string"), list(key = "term", label = "Term", type = "string"),
list(key = "f", label = "F", type = "number"), list(key = "df1", label = "df1", type = "number"), list(key = "df2", label = "df2", type = "number"),
list(key = "p", label = "p", type = "pvalue"), list(key = "p_holm", label = "p (Holm)", type = "pvalue"), list(key = "eta_p", label = "Partial η²", type = "number")),
rows = uni_rows
)
}
f0 <- factor_cols[1]
levels0 <- levels(df[[f0]])
codes0 <- as.integer(df[[f0]]) - 1L
means_rows <- lapply(seq_along(levels0), function(i) {
row <- list(level = levels0[i], n = sum(codes0 == i - 1L))
for (j in seq_len(dims)) row[[sprintf("m%d", j - 1L)]] <- mean(Y[codes0 == i - 1L, j])
row
})
tables[[length(tables) + 1]] <- list(key = "means", title = sprintf("Means by %s", f0),
columns = c(list(list(key = "level", label = f0, type = "string"), list(key = "n", label = "n", type = "integer")),
lapply(seq_len(dims), function(j) list(key = sprintf("m%d", j - 1L), label = outcomes[j], type = "number"))),
rows = means_rows)
tot <- sum(can$eig[seq_len(s_head)])
can_rows <- lapply(seq_len(s_head), function(i) {
row <- list(dim = i, eig = can$eig[i], r = can$can_corr[i], share = if (tot > 0) can$eig[i] / tot else NULL)
for (j in seq_len(dims)) row[[sprintf("s%d", j - 1L)]] <- can$structure[j, i]
row
})
tables[[length(tables) + 1]] <- list(key = "canonical", title = sprintf("Canonical dimensions of %s", head_term$name),
columns = c(list(list(key = "dim", label = "Dimension", type = "integer"), list(key = "eig", label = "Eigenvalue", type = "number"),
list(key = "r", label = "Canonical r", type = "number"), list(key = "share", label = "Share of the effect", type = "number")),
lapply(seq_len(dims), function(j) list(key = sprintf("s%d", j - 1L), label = sprintf("Structure: %s", outcomes[j]), type = "number"))),
rows = can_rows)
chart_rows <- unique(round(seq(1, nrow(df), length.out = min(nrow(df), 5000))))
two <- s_head >= 2
cx <- can$scores[, 1]
cy <- if (two) can$scores[, 2] else rep(0, n)
cent_x <- vapply(seq_along(levels0), function(i) mean(cx[codes0 == i - 1L]), 0)
cent_y <- vapply(seq_along(levels0), function(i) if (two) mean(cy[codes0 == i - 1L]) else 0, 0)
cent_r <- vapply(seq_along(levels0), function(i) sqrt(stats::qchisq(conf, if (two) 2 else 1) / sum(codes0 == i - 1L)), 0)
reach <- max(1e-12, max(abs(c(cx, cy))))
sx <- can$structure[, 1]
sy <- if (two) can$structure[, 2] else rep(0, dims)
longest <- max(1e-12, max(sqrt(sx^2 + sy^2)))
scale <- 0.8 * reach / longest
np <- length(chart_rows)
nl <- length(levels0)
dist2 <- cs_mv_mahalanobis_sq(resid, E / df_res)
cs_publish(list(
method = "multivariate.manova",
methodVersion = "1.0.1",
title = sprintf("%s (%s)", kind, NAMES[[test]]),
engine = cs_engine_info("stats", "nanoparquet"),
n = n,
summary = summary,
apa = sprintf("%s = %s, F(%.0f, %s) = %s, %s, partial η² = %s", SYMBOL[[test]], cs_fmt_num(lead$stat), lead$df1, format(signif(lead$df2, 4)),
cs_fmt_num(lead$f), cs_fmt_p(p), cs_fmt_num(lead$eta, leading_zero = FALSE)),
statistics = list(list(key = "stat", label = SYMBOL[[test]], value = lead$stat), list(key = "f", label = "F", value = lead$f),
list(key = "df1", label = "df1", value = lead$df1), list(key = "df2", label = "df2", value = lead$df2),
list(key = "p", label = "p", value = p, format = "p")),
tables = tables,
effectSizes = list(list(key = "eta_p", label = "Multivariate partial η²", value = lead$eta,
method = paste0(c(pillai = "V / s", wilks = "1 − Λ^(1/s)", hotelling_lawley = "(T/s) / (1 + T/s)", roy = "Θ / (1 + Θ)")[[test]], sprintf(", s = %d", s_head)),
magnitude = size, ruleSet = "Cohen (1988)")),
assumptions = assumptions,
warnings = warnings,
notes = list(sprintf("Type %s sums of squares and cross-products with sum-to-zero contrasts (car::Manova); F approximations as in R's summary.manova (Rao's F for Wilks). Roy's F is an upper bound, so its p-value is optimistic.", ss_type)),
values = values,
charts = list(
cs_chart("canonical", "canonical-plot", sprintf("Canonical discriminant plot of %s", head_term$name), list(
x = cs_col(sprintf("Can1 (r = %.2f)", can$can_corr[1]), c(cx[chart_rows], cent_x, sx * scale), "numeric"),
y = cs_col(if (two) sprintf("Can2 (r = %.2f)", can$can_corr[2]) else "(one dimension)", c(cy[chart_rows], cent_y, sy * scale), "numeric"),
group = cs_col(f0, c(as.character(df[[f0]][chart_rows]), levels0, rep("", dims)), "categorical", levels = c(levels0, "")),
kind = cs_col("kind", c(rep("point", np), rep("mean", nl), rep("structure", dims)), "categorical"),
label = cs_col("label", c(rep("", np), levels0, outcomes), "categorical"),
radius = cs_col(sprintf("%.0f%% radius of the mean", conf * 100), c(rep(NA_real_, np), cent_r, rep(NA_real_, dims)), "numeric")),
controls = list(scale = scale)),
cs_chart("mahalanobis", "mahalanobis-qq", "Residual squared Mahalanobis distances against χ² quantiles", list(
d2 = cs_col("D² of each row", dist2[chart_rows], "numeric")), controls = list(df = dims))
)
))
V = 0.55, F(6, 120) = 7.50, p < .001, partial η² = .27
- V
- 0.5456
- F
- 7.504
- df1
- 6
- df2
- 120
- p
- < .001
Effect size
- Multivariate partial η² 0.2728 · large
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Multivariate normality of residuals — Mardia skewness χ²(10) = 12.43, p = .257; kurtosis z = 0.08, p = .939.
- Equal covariance matrices — Box's M χ²(12) = 14.36, p = .278 across 3 cells (judged at α = 0.001).
- Enough residual df — 61 residual df for 3 outcomes.
Multivariate tests (Type II)
| Term | Test | Statistic | Approx. F | df1 | df2 | p | Partial η² |
|---|---|---|---|---|---|---|---|
| group | Pillai's trace | 0.5456 | 7.504 | 6 | 120 | < .001 | 0.2728 |
| group | Wilks' lambda | 0.5198 | 7.611 | 6 | 118 | < .001 | 0.2790 |
| group | Hotelling–Lawley trace | 0.7978 | 7.712 | 6 | 116 | < .001 | 0.2852 |
| group | Roy's largest root | 0.5811 | 11.623 | 3 | 60 | < .001 | 0.3675 |
| pretest1 | Pillai's trace | 0.4654 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Wilks' lambda | 0.5346 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Hotelling–Lawley trace | 0.8704 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest1 | Roy's largest root | 0.8704 | 17.118 | 3 | 59 | < .001 | 0.4654 |
| pretest2 | Pillai's trace | 0.1275 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Wilks' lambda | 0.8725 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Hotelling–Lawley trace | 0.1461 | 2.873 | 3 | 59 | .044 | 0.1275 |
| pretest2 | Roy's largest root | 0.1461 | 2.873 | 3 | 59 | .044 | 0.1275 |
Univariate follow-up ANOVAs
| Outcome | Term | F | df1 | df2 | p | p (Holm) | Partial η² |
|---|---|---|---|---|---|---|---|
| post1 | group | 12.658 | 2 | 61 | < .001 | < .001 | 0.2933 |
| post2 | group | 9.739 | 2 | 61 | < .001 | < .001 | 0.2420 |
| post3 | group | 4.497 | 2 | 61 | .015 | .015 | 0.1285 |
| post1 | pretest1 | 35.481 | 1 | 61 | < .001 | < .001 | 0.3678 |
| post2 | pretest1 | 0.8551 | 1 | 61 | .359 | .718 | 0.0138 |
| post3 | pretest1 | 0.2985 | 1 | 61 | .587 | .718 | 0.0049 |
| post1 | pretest2 | 3.576 | 1 | 61 | .063 | .190 | 0.0554 |
| post2 | pretest2 | 2.887 | 1 | 61 | .094 | .190 | 0.0452 |
| post3 | pretest2 | 3.066 | 1 | 61 | .085 | .190 | 0.0479 |
Means by group
| group | n | post1 | post2 | post3 |
|---|---|---|---|---|
| Basal | 22 | 6.682 | 5.545 | 41.045 |
| DRTA | 22 | 9.773 | 6.227 | 46.727 |
| Strat | 22 | 7.773 | 8.364 | 44.273 |
Canonical dimensions of group
| Dimension | Eigenvalue | Canonical r | Share of the effect | Structure: post1 | Structure: post2 | Structure: post3 |
|---|---|---|---|---|---|---|
| 1 | 0.5811 | 0.6063 | 0.7284 | 0.8426 | 0.5768 | 0.4691 |
| 2 | 0.2167 | 0.4220 | 0.2716 | −0.6476 | 0.7186 | −0.3486 |
- Type II sums of squares and cross-products with sum-to-zero contrasts (car::Manova); F approximations as in R's summary.manova (Rao's F for Wilks). Roy's F is an upper bound, so its p-value is optimistic.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# MANOVA / MANCOVA
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method multivariate.manova 1.0.1 · spec 05996be0622cb7cf
# Dataset: mv_baumann (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import numpy as np
import pandas as pd
from scipy import stats
import codesplash as cs
from codesplash.stats import multivariate as mv
from codesplash.stats.padjust import p_adjust
# %% Data
df = pd.read_parquet("tests/parity/fixtures/mv_baumann.parquet", columns=["post1", "post2", "post3", "group", "pretest1", "pretest2"])
n_input = len(df)
df["group"] = pd.Categorical(df["group"], categories=["Basal", "DRTA", "Strat"]) # stored level order
df = df.dropna(subset=["post1", "post2", "post3", "group", "pretest1", "pretest2"]) # listwise deletion over the analysis columns
df["group"] = df["group"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["post1", "post2", "post3", "group", "pretest1", "pretest2"]) # infinite values stop the run (registry/errors.yaml)
# %% Helpers
def magnitude(x, cuts, labels=("negligible", "small", "medium", "large")):
"""Benchmark label for an effect size (rule set named in the result)."""
if x is None or not np.isfinite(x):
return "undetermined"
for cut, label in zip(cuts, labels):
if abs(x) < cut:
return label
return labels[-1]
# %% Model
# car::Manova(lm(cbind(...) ~ factors + covariates), type = "II" | "III") with sum-to-zero contrasts.
outcomes = ["post1", "post2", "post3"]
factor_cols = ["group"]
covariate_cols = ["pretest1", "pretest2"]
test = "pillai" # pillai | wilks | hotelling_lawley | roy
ss_type = "II"
interactions = True and len(factor_cols) > 1
univariate = True
conf = 0.95
alpha = 1 - conf
Y = df[outcomes].to_numpy(dtype=float)
n, dims = Y.shape
factors = []
for f in factor_cols:
L = len(df[f].cat.categories)
if L < 2:
cs.cs_error("CS_E_TOO_FEW_GROUPS", column=f, min=2, k=L)
factors.append((f, df[f].cat.codes.to_numpy(), L))
for j, o in enumerate(outcomes):
if len(np.unique(Y[:, j])) < 2: # a constant outcome makes the residual SSCP matrix singular
cs.cs_error("CS_E_CONSTANT", column=o)
covs = [(c, df[c].to_numpy(dtype=float)) for c in covariate_cols]
fit = mv.mlm_terms(Y, factors, covs, interactions, ss_type)
E, df_res = fit["E"], fit["df_res"]
NAMES = {"pillai": "Pillai's trace", "wilks": "Wilks' lambda", "hotelling_lawley": "Hotelling–Lawley trace", "roy": "Roy's largest root"}
SYMBOL = {"pillai": "V", "wilks": "Λ", "hotelling_lawley": "T", "roy": "Θ"}
results = []
for t in fit["terms"]:
results.append((t, mv.mv_tests(t["H"], E, t["q"], df_res)))
head_term, head = results[0]
lead = head[test]
# %% Univariate follow-ups
uni_rows = []
if univariate:
for t, _ in results:
ps = []
rows = []
for j, o in enumerate(outcomes):
h, e = float(t["H"][j, j]), float(E[j, j])
fj = (h / t["q"]) / (e / df_res)
pj = float(stats.f.sf(fj, t["q"], df_res))
rows.append({"outcome": o, "term": t["name"], "f": fj, "df1": float(t["q"]), "df2": float(df_res), "p": pj, "eta_p": h / (h + e)})
ps.append(pj)
holm = p_adjust(ps, "holm")
for r, ph in zip(rows, holm):
r["p_holm"] = float(ph)
uni_rows.extend(rows)
# %% Canonical discriminant dimensions of the first factor
can = mv.canonical(head_term["H"], E, df_res, Y)
s_head = min(dims, head_term["q"])
# %% Assumptions
assumptions = []
X = fit["X"]
resid = Y - X @ np.linalg.lstsq(X, Y, rcond=None)[0]
mardia = mv.mardia(resid) if n > dims + 1 else None
if mardia is None:
assumptions.append({"key": "mv_normality", "label": "Multivariate normality of residuals", "status": "info", "detail": "Mardia's tests need more rows than outcomes + 1."})
else:
ok = mardia["skew_p"] >= 0.05 and mardia["kurt_p"] >= 0.05
status = "pass" if ok else ("info" if df_res >= 50 else "warn")
assumptions.append({"key": "mv_normality", "label": "Multivariate normality of residuals", "status": status, "statistic": mardia["skew"], "p": min(mardia["skew_p"], mardia["kurt_p"]),
"detail": f"Mardia skewness χ²({mardia['skew_df']:.0f}) = {mardia['skew']:.2f}, {cs.fmt_p(mardia['skew_p'])}; kurtosis z = {mardia['kurt_z']:.2f}, {cs.fmt_p(mardia['kurt_p'])}"
+ ((". Pillai's trace is the most robust statistic." if status == "warn" else "; with this many residual df the tests are fairly robust.") if not ok else ".")})
cells = pd.Series(list(zip(*[df[f].astype(str) for f in factor_cols]))) if factor_cols else pd.Series(["all"] * n)
cell_codes = cells.astype("category").cat.codes.to_numpy()
cell_groups = [resid[cell_codes == c] for c in range(cell_codes.max() + 1)]
box = mv.box_m(cell_groups) if len(cell_groups) > 1 and min(g.shape[0] for g in cell_groups) > dims else None
if box is None:
assumptions.append({"key": "equal_covariance", "label": "Equal covariance matrices", "status": "info",
"detail": "Box's M needs every factor cell larger than the number of outcomes; " + ("Pillai's trace is the safest statistic." if test == "pillai" else "prefer Pillai's trace.")})
else:
status = "warn" if box["p"] < 0.001 else "pass"
detail = f"Box's M χ²({box['df']:.0f}) = {box['chisq']:.2f}, {cs.fmt_p(box['p'])} across {len(cell_groups)} cells"
if status == "warn":
detail += "; Pillai's trace is the most robust choice." if test == "pillai" else "; switch to Pillai's trace, the most robust statistic."
else:
detail += " (judged at α = 0.001)."
assumptions.append({"key": "equal_covariance", "label": "Equal covariance matrices", "status": status, "statistic": box["chisq"], "p": box["p"], "detail": detail})
status = "warn" if df_res < dims + 5 else "pass"
assumptions.append({"key": "sample_size", "label": "Enough residual df", "status": status,
"detail": f"{df_res} residual df for {dims} outcomes" + ("; estimates are unstable." if status == "warn" else ".")})
# %% Result
size = magnitude(lead["eta"], (0.01, 0.06, 0.14))
p = lead["p"]
adj = f" adjusting for {', '.join(covariate_cols)}" if covariate_cols else ""
kind = "MANCOVA" if covariate_cols else "MANOVA"
significance = (f"The outcomes jointly differ across {head_term['name']} ({cs.fmt_p(p)})." if p < alpha
else f"The data are compatible with equal mean vectors across {head_term['name']} ({cs.fmt_p(p)}).")
summary = f"{kind} of {', '.join(outcomes)}{adj} with {NAMES[test]} (Type {ss_type}). {significance} Multivariate partial η² = {lead['eta']:.2f} ({size})."
others = [f"{t['name']} ({cs.fmt_p(r[test]['p'])})" for t, r in results[1:]]
if others:
summary += " Other terms: " + "; ".join(others) + "."
if univariate:
sig_uni = [r["outcome"] for r in uni_rows if r["term"] == head_term["name"] and r["p_holm"] < alpha]
summary += f" Univariate follow-ups: {len(sig_uni)} of {dims} outcomes differ across {head_term['name']} (Holm)."
values = {"stat": lead["stat"], "f": lead["f"], "df1": lead["df1"], "df2": lead["df2"], "p": p, "eta_p": lead["eta"],
"n": n, "dims": dims, "df_res": float(df_res), "k_terms": len(results),
"mardia_skew_p": None if mardia is None else mardia["skew_p"], "mardia_kurt_p": None if mardia is None else mardia["kurt_p"],
"box_m_p": None if box is None else box["p"]}
mv_rows = []
for t, r in results:
for key in ("pillai", "wilks", "hotelling_lawley", "roy"):
x = r[key]
values[f"{key}[{t['name']}]"] = x["stat"]
values[f"{key}_f[{t['name']}]"] = x["f"]
values[f"{key}_df1[{t['name']}]"] = x["df1"]
values[f"{key}_df2[{t['name']}]"] = x["df2"]
values[f"{key}_p[{t['name']}]"] = x["p"]
mv_rows.append({"term": t["name"], "test": NAMES[key], "stat": x["stat"], "f": x["f"], "df1": x["df1"], "df2": x["df2"], "p": x["p"], "eta_p": x["eta"]})
values[f"eta_p[{t['name']}]"] = r[test]["eta"]
for r in uni_rows:
k = f"{r['outcome']}|{r['term']}"
values[f"uni_f[{k}]"] = r["f"]
values[f"uni_p[{k}]"] = r["p"]
values[f"uni_p_holm[{k}]"] = r["p_holm"]
values[f"uni_eta_p[{k}]"] = r["eta_p"]
for i in range(s_head):
values[f"can_corr[{i + 1}]"] = float(can["can_corr"][i])
values["missing_share"] = n_dropped / n_input if n_input else 0.0
values["max_interaction_order"] = len(factor_cols) if interactions else 1
tables = [{
"key": "multivariate", "title": f"Multivariate tests (Type {ss_type})",
"columns": [{"key": "term", "label": "Term", "type": "string"}, {"key": "test", "label": "Test", "type": "string"},
{"key": "stat", "label": "Statistic", "type": "number"}, {"key": "f", "label": "Approx. F", "type": "number"},
{"key": "df1", "label": "df1", "type": "number"}, {"key": "df2", "label": "df2", "type": "number"},
{"key": "p", "label": "p", "type": "pvalue"}, {"key": "eta_p", "label": "Partial η²", "type": "number"}],
"rows": mv_rows,
}]
if univariate:
tables.append({
"key": "univariate", "title": "Univariate follow-up ANOVAs",
"columns": [{"key": "outcome", "label": "Outcome", "type": "string"}, {"key": "term", "label": "Term", "type": "string"},
{"key": "f", "label": "F", "type": "number"}, {"key": "df1", "label": "df1", "type": "number"}, {"key": "df2", "label": "df2", "type": "number"},
{"key": "p", "label": "p", "type": "pvalue"}, {"key": "p_holm", "label": "p (Holm)", "type": "pvalue"}, {"key": "eta_p", "label": "Partial η²", "type": "number"}],
"rows": uni_rows,
})
f0 = factor_cols[0]
levels0 = [str(lv) for lv in df[f0].cat.categories]
codes0 = df[f0].cat.codes.to_numpy()
means_rows = []
for i, lv in enumerate(levels0):
row = {"level": lv, "n": int((codes0 == i).sum())}
for j, o in enumerate(outcomes):
row[f"m{j}"] = float(Y[codes0 == i, j].mean())
means_rows.append(row)
tables.append({"key": "means", "title": f"Means by {f0}",
"columns": [{"key": "level", "label": f0, "type": "string"}, {"key": "n", "label": "n", "type": "integer"}]
+ [{"key": f"m{j}", "label": o, "type": "number"} for j, o in enumerate(outcomes)],
"rows": means_rows})
tables.append({"key": "canonical", "title": f"Canonical dimensions of {head_term['name']}",
"columns": [{"key": "dim", "label": "Dimension", "type": "integer"}, {"key": "eig", "label": "Eigenvalue", "type": "number"},
{"key": "r", "label": "Canonical r", "type": "number"}, {"key": "share", "label": "Share of the effect", "type": "number"}]
+ [{"key": f"s{j}", "label": f"Structure: {o}", "type": "number"} for j, o in enumerate(outcomes)],
"rows": [dict({"dim": i + 1, "eig": float(can["eig"][i]), "r": float(can["can_corr"][i]),
"share": float(can["eig"][i] / can["eig"][:s_head].sum()) if can["eig"][:s_head].sum() > 0 else None},
**{f"s{j}": float(can["structure"][j, i]) for j in range(dims)}) for i in range(s_head)]})
chart_rows = np.unique(np.round(np.linspace(0, len(df) - 1, min(len(df), 5000))).astype(int))
two = s_head >= 2
cx, cy = can["scores"][:, 0], (can["scores"][:, 1] if two else np.zeros(n))
centroids = [(lv, float(cx[codes0 == i].mean()), float(cy[codes0 == i].mean()) if two else 0.0, float(np.sqrt(stats.chi2.ppf(conf, 2 if two else 1) / (codes0 == i).sum())))
for i, lv in enumerate(levels0)]
reach = max(1e-12, float(np.max(np.abs(np.concatenate([cx, cy])))))
longest = max(1e-12, float(np.max(np.hypot(can["structure"][:, 0], can["structure"][:, 1] if two else 0))))
scale = 0.8 * reach / longest
kind_col = ["point"] * len(chart_rows) + ["mean"] * len(levels0) + ["structure"] * dims
can_x = list(cx[chart_rows]) + [c[1] for c in centroids] + list(can["structure"][:, 0] * scale)
can_y = list(cy[chart_rows]) + [c[2] for c in centroids] + list((can["structure"][:, 1] if two else np.zeros(dims)) * scale)
can_g = list(df[f0].astype(str).to_numpy()[chart_rows]) + levels0 + [""] * dims
can_l = [""] * len(chart_rows) + levels0 + outcomes
can_r = [None] * len(chart_rows) + [c[3] for c in centroids] + [None] * dims
dist2 = mv.mahalanobis_sq(resid, E / df_res)
cs.publish({
"method": "multivariate.manova",
"methodVersion": "1.0.1",
"title": f"{kind} ({NAMES[test]})",
"engine": cs.engine_info("pandas", "numpy", "scipy"),
"n": n,
"summary": summary,
"apa": f"{SYMBOL[test]} = {cs.fmt_num(lead['stat'])}, F({lead['df1']:.0f}, {lead['df2']:.4g}) = {cs.fmt_num(lead['f'])}, {cs.fmt_p(p)}, partial η² = {cs.fmt_num(lead['eta'], leading_zero=False)}",
"statistics": [{"key": "stat", "label": SYMBOL[test], "value": lead["stat"]}, {"key": "f", "label": "F", "value": lead["f"]},
{"key": "df1", "label": "df1", "value": lead["df1"]}, {"key": "df2", "label": "df2", "value": lead["df2"]},
{"key": "p", "label": "p", "value": p, "format": "p"}],
"tables": tables,
"effectSizes": [{"key": "eta_p", "label": "Multivariate partial η²", "value": lead["eta"],
"method": {"pillai": "V / s", "wilks": "1 − Λ^(1/s)", "hotelling_lawley": "(T/s) / (1 + T/s)", "roy": "Θ / (1 + Θ)"}[test] + f", s = {s_head}",
"magnitude": size, "ruleSet": "Cohen (1988)"}],
"assumptions": assumptions,
"warnings": warnings,
"notes": [f"Type {ss_type} sums of squares and cross-products with sum-to-zero contrasts (car::Manova); F approximations as in R's summary.manova (Rao's F for Wilks). Roy's F is an upper bound, so its p-value is optimistic."],
"values": values,
"charts": [
cs.chart("canonical", "canonical-plot", f"Canonical discriminant plot of {head_term['name']}", {
"x": cs.col(f"Can1 (r = {can['can_corr'][0]:.2f})", can_x, "numeric"),
"y": cs.col(f"Can2 (r = {can['can_corr'][1]:.2f})" if two else "(one dimension)", can_y, "numeric"),
"group": cs.col(f0, can_g, "categorical", levels=levels0 + [""]),
"kind": cs.col("kind", kind_col, "categorical"),
"label": cs.col("label", can_l, "categorical"),
"radius": cs.col(f"{conf:.0%} radius of the mean", can_r, "numeric")}, controls={"scale": scale}),
cs.chart("mahalanobis", "mahalanobis-qq", "Residual squared Mahalanobis distances against χ² quantiles", {
"d2": cs.col("D² of each row", dist2[chart_rows], "numeric")}, controls={"df": dims}),
],
})
Adjusting for the pre-tests, the method effect has Pillai's V = 0.55, F(6, 120) = 7.50, p < .001.
Open Univariate follow-up ANOVAs and look at the Holm column. Which post-test does the first pre-test relate to most strongly?
Two factors
ReadWith more than one factor, Sums of squares matters as soon as cell sizes are unequal. Type II, the default, tests each main effect after the other. Type III tests it with the interaction in the model, so it depends on the contrast coding.
With treatment, gender and their interaction, on five outcomes, the Type III test of treatment gives Pillai's V = 0.76, p = .590.
Turn off Include interactions and use three outcomes, and treatment gives V = 0.50, p = .332.
How many outcomes can your sample carry?
PredictPredict first
The factorial study has 16 people, 5 outcomes and only 10 residual degrees of freedom.
What should worry you when you read p = 0.59?
Reveal
Few residual degrees of freedom cost power, because must estimate a whole covariance matrix. The data are compatible with no effect, and also with a sizeable one. Partial here is 0.38. Don't report this as no effect.
What would you report?
ReflectWrite one sentence on the MANCOVA above: the statistic and its F, the effect size, the covariates, and what the term table adds.
Then compare it with the summary and APA sentence on the card. If a follow-up isn't significant after Holm, say so instead of leaving it out.
Factorial designs, covariates, multivariate (ANCOVA, MANOVA) · Statistics GuideCheck your understanding
CheckpointCheck yourself
MANOVA gives p < 0.001. One follow-up ANOVA has p = 0.03 before adjustment and p = 0.09 after Holm. What do you report?
Show the answer
Answer: b
Report the adjusted value along with the size of the effect. Rerunning on one outcome after looking is a forking path.
Check yourself
Why might a large joint effect show no single strong outcome?
Show the answer
Answer: b
The canonical dimensions show the combination that separates groups. A weighted contrast between two outcomes can be strong when neither alone is.
Check yourself
Which assumption does MANCOVA add beyond MANOVA's?
Show the answer
Answer: b
As with ANCOVA, a single set of adjustment slopes is assumed across groups. And covariates measured after treatment can absorb part of the effect, so measure them before it.
Do it in CodeSplash
In the appAdd Covariates and more Factors to the same MANOVA. Univariate follow-up ANOVAs is on by default.
import pandas as pd
from statsmodels.multivariate.manova import MANOVA
df = pd.read_csv("baumann.csv")
m = MANOVA.from_formula("post1 + post2 + post3 ~ group + pretest1 + pretest2", data=df)
print(m.mv_test())# install.packages("car")
df <- read.csv("baumann.csv")
fit <- lm(cbind(post1, post2, post3) ~ group + pretest1 + pretest2, data = df)
car::Manova(fit, type = "II")Recap
Recap- A joint result doesn't protect the follow-ups: adjust them, and report what didn't hold up.
- Canonical dimensions show the direction behind the result; follow-up ANOVAs show one outcome at a time.
- Covariates and factors extend MANOVA as they do ANOVA, including the Type II or III choice.
- Each extra outcome costs degrees of freedom. Check the residual df first.
Concepts in this lesson