Skip to content

Profile analysis: parallel, level, flat

Compare groups across ordered measures by asking three separate questions, in the right order, and see how they connect to repeated measures.

Advanced ~11 min9 steps

What runs in CodeSplash

You will be able to

  • State the parallelism, levels and flatness hypotheses in plain words
  • Read a profile plot and say which question comes first
  • Explain why a non-parallel profile changes how you read the other two tests

Read first

01

Three questions about one plot

Read

Profile analysisProfile analysisCompares groups' mean profiles across measures on one scale — parallel, level and flat. needs a group factor and several measures in a meaningful order: pre-test, post-test, follow-up, or a set of subscales on one scale.

Draw each group's means across the measures, then ask:

  1. Parallel? Do the lines have the same shape?
  2. Levels? Is one group higher overall?
  3. Flat? Do the means change across the measures?

Parallelism is a group × measure interaction. Each question has its own test.

02

Which comes first?

Predict

Predict first

Two groups' lines cross in the middle of the plot. One group starts low and ends high.

Which test do you need to read first?

Levels first: it's the main interestParallelism first: the other two depend on itAny order: they are independent
Reveal

Parallelism first. If the lines cross, "group A is higher overall" is misleading, because the answer depends on which measure you look at. The levels and flatness tests still give numbers, but they average over a pattern that differs between groups.

03

How the tests work

Read

Take successive differences within each row: measure 2 − measure 1, measure 3 − measure 2, and so on. Each test then has a familiar form:

QuestionWhat is tested
ParallelMANOVA on the differences, by group
LevelsOne-way ANOVA on each row's mean
FlatHotelling's T² on the differences against zero

This makes no assumption of sphericitySphericityIn repeated measures, the assumption that differences between every pair of conditions have equal variance.. It is the multivariate route through a repeated-measures design.

04

Read a clean case

In the app
Profile analysisRecorded · Python and R agreeRecorded 2026-11-25 · 29 values compared
R

parallelism F(2, 87) = 0.07, p = .930; levels F(1, 88) = 22.74, p < .001; flatness F(2, 87) = 0.36, p = .697

F (parallelism)
0.0731
p (parallelism)
.930
p (levels)
< .001
p (flatness)
.697

Effect size

  • Partial η² (parallelism) 0.0017 · negligible
  • η² (levels) 0.2053

Plots

Mean profiles by group (95% intervals)Do the groups' mean profiles run parallel across the measures, at the same level, and is the common profile flat?
View data
groupCI highCI lowMeanMeasure
g10.2781−0.3609−0.0414y1
g10.1600−0.4190−0.1295y2
g10.2288−0.5094−0.1403y3
g20.76220.25260.5074y1
g20.74770.19820.4730y2
g20.61240.10600.3592y3

Assumptions

  • Measures on one scale — Profile analysis compares differences between the measures — check they share units (e.g. the same scale at each time).
  • Multivariate normality of the differences — Mardia skewness p = .779, kurtosis z = -0.17, p = .867.
  • Equal covariance matrices — Box's M χ²(6) = 5.64, p = .464 (judged at α = 0.001).

Profile tests

TestWilks' lambda / T²Fdf1df2p
Parallelism (group × measure)0.99830.0731287.930
Levels (equal group means)—22.738188< .001
Flatness (equal measure means)0.73240.3620287.697

Group profiles (means)

groupny1y2y3
g140−0.0414−0.1295−0.1403
g2500.50740.47300.3592
  • Successive-difference contrasts; the parallelism test is the multivariate (sphericity-free) test of the group × measure interaction, flatness uses the pooled within-group covariance (N − k df).
The exact R script · R R version 4.5.1 (2025-06-13)
# Profile analysis
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method multivariate.profile 1.0.1 · spec c553d8a38357771a
# Dataset: mv_guide (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_guide.parquet", col_select = c("y1", "y2", "y3", "group")))
n_input <- nrow(df)
df[["group"]] <- factor(df[["group"]], levels = c("g1", "g2"))  # stored level order
df <- df[stats::complete.cases(df[c("y1", "y2", "y3", "group")]), , 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("y1", "y2", "y3", "group"))  # 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]
}

# %% Test
# Profile analysis (Morrison 2005, §4.7): parallelism = MANOVA of successive differences; levels =
# ANOVA of each row's mean; flatness = T² of the mean differences with the pooled within covariance.
measures <- c("y1", "y2", "y3")
g <- "group"
test <- "wilks"
conf <- 0.95
alpha <- 1 - conf
levels_g <- levels(df[[g]])
k <- length(levels_g)
if (k < 2) cs_error("CS_E_TOO_FEW_GROUPS", column = g, min = 2, k = k)
X <- as.matrix(df[measures])
storage.mode(X) <- "double"
codes <- as.integer(df[[g]]) - 1L
n <- nrow(X)
dims <- ncol(X)
res <- cs_mv_profile(X, codes, k)
par <- res$parallel[[test]]
lev <- res$levels
flat <- res$flatness

# %% Assumptions
assumptions <- list(list(key = "commensurate", label = "Measures on one scale", status = "info",
                         detail = "Profile analysis compares differences between the measures — check they share units (e.g. the same scale at each time)."))
D <- res$D
gm <- t(vapply(seq_len(k) - 1L, function(c) colMeans(D[codes == c, , drop = FALSE]), numeric(ncol(D))))
if (ncol(D) == 1) gm <- matrix(gm, ncol = 1)
resid <- D - gm[codes + 1L, , drop = FALSE]
mardia <- if (n > dims && dims > 1) cs_mv_mardia(resid) else NULL
if (!is.null(mardia)) {
  ok <- mardia$skew_p >= 0.05 && mardia$kurt_p >= 0.05
  status <- if (ok) "pass" else if (n - k >= 50) "info" else "warn"
  assumptions[[length(assumptions) + 1]] <- list(key = "mv_normality", label = "Multivariate normality of the differences", status = status, p = min(mardia$skew_p, mardia$kurt_p),
                                                 detail = sprintf("Mardia skewness %s, kurtosis z = %.2f, %s.", cs_fmt_p(mardia$skew_p), mardia$kurt_z, cs_fmt_p(mardia$kurt_p)))
}
groups <- lapply(seq_len(k) - 1L, function(c) X[codes == c, , drop = FALSE])
box <- if (min(vapply(groups, nrow, 0L)) > dims) cs_mv_box_m(groups) else NULL
if (is.null(box)) {
  assumptions[[length(assumptions) + 1]] <- list(key = "equal_covariance", label = "Equal covariance matrices", status = "info", detail = "Box's M needs every group larger than the number of measures; Pillai's trace is the safest parallelism test.")
} else {
  status <- if (box$p < 0.001) "warn" else "pass"
  assumptions[[length(assumptions) + 1]] <- list(key = "equal_covariance", label = "Equal covariance matrices", status = status, statistic = box$chisq, p = box$p,
                                                 detail = paste0(sprintf("Box's M χ²(%.0f) = %.2f, %s", box$df, box$chisq, cs_fmt_p(box$p)), if (status == "warn") " — prefer Pillai's trace." else " (judged at α = 0.001)."))
}

# %% Result
NAMES <- c(pillai = "Pillai's trace", wilks = "Wilks' lambda", hotelling_lawley = "Hotelling–Lawley trace", roy = "Roy's largest root")
size <- magnitude(par$eta, c(0.01, 0.06, 0.14))
parts <- c(
  paste0(if (par$p < alpha) "not parallel" else "compatible with parallel", sprintf(" (%s, %s)", NAMES[[test]], cs_fmt_p(par$p))),
  paste0(if (lev$p < alpha) "the group levels differ" else "the group levels do not differ significantly", sprintf(" (%s)", cs_fmt_p(lev$p))),
  paste0(if (flat$p < alpha) "the common profile is not flat" else "the common profile is compatible with flat", sprintf(" (%s)", cs_fmt_p(flat$p)))
)
summary <- sprintf("Profiles of %s across %d groups of %s: the profiles are %s, %s, and %s.", paste(measures, collapse = ", "), k, g, parts[1], parts[2], parts[3])
if (par$p < alpha) summary <- paste(summary, "Because the profiles are not parallel, read the levels and flatness tests with care (they average over a group × measure interaction).")
values <- list(parallel_stat = par$stat, parallel_f = par$f, parallel_df1 = par$df1, parallel_df2 = par$df2, parallel_p = par$p, parallel_eta_p = par$eta,
               levels_f = lev$f, levels_df1 = lev$df1, levels_df2 = lev$df2, levels_p = lev$p, levels_eta_p = lev$eta,
               flat_t2 = flat$t2, flat_f = flat$f, flat_df1 = flat$df1, flat_df2 = flat$df2, flat_p = flat$p,
               k = k, n = n, dims = dims, 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)
pm <- character(0)
pg <- character(0)
pmean <- numeric(0)
plow <- numeric(0)
phigh <- numeric(0)
for (i in seq_len(k)) {
  ni <- res$ns[i]
  tcrit <- if (ni > 1) stats::qt(1 - alpha / 2, ni - 1) else NA_real_
  for (j in seq_len(dims)) {
    mu <- res$means[i, j]
    half <- if (ni > 1) tcrit * res$sds[i, j] / sqrt(ni) else NA_real_
    values[[sprintf("mean[%s|%s]", levels_g[i], measures[j])]] <- mu
    pm <- c(pm, measures[j])
    pg <- c(pg, levels_g[i])
    pmean <- c(pmean, mu)
    plow <- c(plow, mu - half)
    phigh <- c(phigh, mu + half)
  }
}
values$missing_share <- if (n_input > 0) n_dropped / n_input else 0
tests_rows <- list(
  list(test = "Parallelism (group × measure)", stat = par$stat, f = par$f, df1 = par$df1, df2 = par$df2, p = par$p),
  list(test = "Levels (equal group means)", stat = NULL, f = lev$f, df1 = lev$df1, df2 = lev$df2, p = lev$p),
  list(test = "Flatness (equal measure means)", stat = flat$t2, f = flat$f, df1 = flat$df1, df2 = flat$df2, p = flat$p)
)
means_rows <- lapply(seq_len(k), function(i) {
  row <- list(group = levels_g[i], n = res$ns[i])
  for (j in seq_len(dims)) row[[sprintf("m%d", j - 1L)]] <- res$means[i, j]
  row
})
cs_publish(list(
  method = "multivariate.profile",
  methodVersion = "1.0.1",
  title = "Profile analysis",
  engine = cs_engine_info("stats", "nanoparquet"),
  n = n,
  summary = summary,
  apa = sprintf("parallelism F(%.0f, %s) = %s, %s; levels F(%.0f, %.0f) = %s, %s; flatness F(%.0f, %.0f) = %s, %s",
                par$df1, format(signif(par$df2, 4)), cs_fmt_num(par$f), cs_fmt_p(par$p), lev$df1, lev$df2, cs_fmt_num(lev$f), cs_fmt_p(lev$p),
                flat$df1, flat$df2, cs_fmt_num(flat$f), cs_fmt_p(flat$p)),
  statistics = list(list(key = "parallel_f", label = "F (parallelism)", value = par$f), list(key = "parallel_p", label = "p (parallelism)", value = par$p, format = "p"),
                    list(key = "levels_p", label = "p (levels)", value = lev$p, format = "p"), list(key = "flat_p", label = "p (flatness)", value = flat$p, format = "p")),
  tables = list(
    list(key = "tests", title = "Profile tests",
         columns = list(list(key = "test", label = "Test", type = "string"), list(key = "stat", label = sprintf("%s / T²", NAMES[[test]]), type = "number"),
                        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")),
         rows = tests_rows),
    list(key = "means", title = "Group profiles (means)",
         columns = c(list(list(key = "group", label = g, type = "string"), list(key = "n", label = "n", type = "integer")),
                     lapply(seq_len(dims), function(j) list(key = sprintf("m%d", j - 1L), label = measures[j], type = "number"))),
         rows = means_rows)
  ),
  effectSizes = list(list(key = "parallel_eta_p", label = "Partial η² (parallelism)", value = par$eta, method = "multivariate partial η² of the group × measure interaction", magnitude = size, ruleSet = "Cohen (1988)"),
                     list(key = "levels_eta_p", label = "η² (levels)", value = lev$eta, method = "SS between / SS total of the row means")),
  assumptions = assumptions,
  warnings = warnings,
  notes = list("Successive-difference contrasts; the parallelism test is the multivariate (sphericity-free) test of the group × measure interaction, flatness uses the pooled within-group covariance (N − k df)."),
  values = values,
  charts = list(cs_chart("profile", "profile-plot", sprintf("Mean profiles by %s (%.0f%% intervals)", g, conf * 100), list(
    measure = cs_col("Measure", pm, "categorical", levels = measures),
    mean = cs_col("Mean", pmean, "numeric"),
    group = cs_col(g, pg, "categorical", levels = levels_g),
    low = cs_col("CI low", plow, "numeric"),
    high = cs_col("CI high", phigh, "numeric"))))
))
Python

parallelism F(2, 87) = 0.07, p = .930; levels F(1, 88) = 22.74, p < .001; flatness F(2, 87) = 0.36, p = .697

F (parallelism)
0.0731
p (parallelism)
.930
p (levels)
< .001
p (flatness)
.697

Effect size

  • Partial η² (parallelism) 0.0017 · negligible
  • η² (levels) 0.2053

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • Measures on one scale — Profile analysis compares differences between the measures — check they share units (e.g. the same scale at each time).
  • Multivariate normality of the differences — Mardia skewness p = .779, kurtosis z = -0.17, p = .867.
  • Equal covariance matrices — Box's M χ²(6) = 5.64, p = .464 (judged at α = 0.001).

Profile tests

TestWilks' lambda / T²Fdf1df2p
Parallelism (group × measure)0.99830.0731287.930
Levels (equal group means)—22.738188< .001
Flatness (equal measure means)0.73240.3620287.697

Group profiles (means)

groupny1y2y3
g140−0.0414−0.1295−0.1403
g2500.50740.47300.3592
  • Successive-difference contrasts; the parallelism test is the multivariate (sphericity-free) test of the group × measure interaction, flatness uses the pooled within-group covariance (N − k df).
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Profile analysis
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method multivariate.profile 1.0.1 · spec c553d8a38357771a
# Dataset: mv_guide (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

# %% Data
df = pd.read_parquet("tests/parity/fixtures/mv_guide.parquet", columns=["y1", "y2", "y3", "group"])
n_input = len(df)
df["group"] = pd.Categorical(df["group"], categories=["g1", "g2"])  # stored level order
df = df.dropna(subset=["y1", "y2", "y3", "group"])  # 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, ["y1", "y2", "y3", "group"])  # 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]

# %% Test
# Profile analysis (Morrison 2005, §4.7): parallelism = MANOVA of successive differences; levels =
# ANOVA of each row's mean; flatness = T² of the mean differences with the pooled within covariance.
measures = ["y1", "y2", "y3"]
g = "group"
test = "wilks"
conf = 0.95
alpha = 1 - conf
levels = [str(lv) for lv in df[g].cat.categories]
k = len(levels)
if k < 2:
    cs.cs_error("CS_E_TOO_FEW_GROUPS", column=g, min=2, k=k)
X = df[measures].to_numpy(dtype=float)
codes = df[g].cat.codes.to_numpy()
n, dims = X.shape
res = mv.profile_analysis(X, codes, k)
par = res["parallel"][test]
lev, flat = res["levels"], res["flatness"]

# %% Assumptions
assumptions = [{"key": "commensurate", "label": "Measures on one scale", "status": "info",
                "detail": "Profile analysis compares differences between the measures — check they share units (e.g. the same scale at each time)."}]
D = res["D"]
resid = D - np.vstack([D[codes == c].mean(axis=0) for c in range(k)])[codes]
mardia = mv.mardia(resid) if n > dims and dims > 1 else None
if mardia is not None:
    ok = mardia["skew_p"] >= 0.05 and mardia["kurt_p"] >= 0.05
    status = "pass" if ok else ("info" if n - k >= 50 else "warn")
    assumptions.append({"key": "mv_normality", "label": "Multivariate normality of the differences", "status": status, "p": min(mardia["skew_p"], mardia["kurt_p"]),
                        "detail": f"Mardia skewness {cs.fmt_p(mardia['skew_p'])}, kurtosis z = {mardia['kurt_z']:.2f}, {cs.fmt_p(mardia['kurt_p'])}."})
groups = [X[codes == c] for c in range(k)]
box = mv.box_m(groups) if min(x.shape[0] for x in 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 group larger than the number of measures; Pillai's trace is the safest parallelism test."})
else:
    status = "warn" if box["p"] < 0.001 else "pass"
    assumptions.append({"key": "equal_covariance", "label": "Equal covariance matrices", "status": status, "statistic": box["chisq"], "p": box["p"],
                        "detail": f"Box's M χ²({box['df']:.0f}) = {box['chisq']:.2f}, {cs.fmt_p(box['p'])}" + (" — prefer Pillai's trace." if status == "warn" else " (judged at α = 0.001).")})

# %% Result
NAMES = {"pillai": "Pillai's trace", "wilks": "Wilks' lambda", "hotelling_lawley": "Hotelling–Lawley trace", "roy": "Roy's largest root"}
size = magnitude(par["eta"], (0.01, 0.06, 0.14))
parts = [
    ("not parallel" if par["p"] < alpha else "compatible with parallel") + f" ({NAMES[test]}, {cs.fmt_p(par['p'])})",
    ("the group levels differ" if lev["p"] < alpha else "the group levels do not differ significantly") + f" ({cs.fmt_p(lev['p'])})",
    ("the common profile is not flat" if flat["p"] < alpha else "the common profile is compatible with flat") + f" ({cs.fmt_p(flat['p'])})",
]
summary = f"Profiles of {', '.join(measures)} across {k} groups of {g}: the profiles are {parts[0]}, {parts[1]}, and {parts[2]}."
if par["p"] < alpha:
    summary += " Because the profiles are not parallel, read the levels and flatness tests with care (they average over a group × measure interaction)."
values = {"parallel_stat": par["stat"], "parallel_f": par["f"], "parallel_df1": par["df1"], "parallel_df2": par["df2"], "parallel_p": par["p"], "parallel_eta_p": par["eta"],
          "levels_f": lev["f"], "levels_df1": lev["df1"], "levels_df2": lev["df2"], "levels_p": lev["p"], "levels_eta_p": lev["eta"],
          "flat_t2": flat["t2"], "flat_f": flat["f"], "flat_df1": flat["df1"], "flat_df2": flat["df2"], "flat_p": flat["p"],
          "k": k, "n": n, "dims": dims, "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"]}
plot = {"measure": [], "group": [], "mean": [], "low": [], "high": []}
for i, lv in enumerate(levels):
    ni = int(res["ns"][i])
    tcrit = float(stats.t.ppf(1 - alpha / 2, ni - 1)) if ni > 1 else float("nan")
    for j, m in enumerate(measures):
        mu = float(res["means"][i, j])
        half = tcrit * float(res["sds"][i, j]) / np.sqrt(ni) if ni > 1 else float("nan")
        values[f"mean[{lv}|{m}]"] = mu
        plot["measure"].append(m)
        plot["group"].append(lv)
        plot["mean"].append(mu)
        plot["low"].append(mu - half if np.isfinite(half) else None)
        plot["high"].append(mu + half if np.isfinite(half) else None)
values["missing_share"] = n_dropped / n_input if n_input else 0.0
tests_rows = [
    {"test": "Parallelism (group × measure)", "stat": par["stat"], "f": par["f"], "df1": par["df1"], "df2": par["df2"], "p": par["p"]},
    {"test": "Levels (equal group means)", "stat": None, "f": lev["f"], "df1": lev["df1"], "df2": lev["df2"], "p": lev["p"]},
    {"test": "Flatness (equal measure means)", "stat": flat["t2"], "f": flat["f"], "df1": flat["df1"], "df2": flat["df2"], "p": flat["p"]},
]
cs.publish({
    "method": "multivariate.profile",
    "methodVersion": "1.0.1",
    "title": "Profile analysis",
    "engine": cs.engine_info("pandas", "numpy", "scipy"),
    "n": n,
    "summary": summary,
    "apa": (f"parallelism F({par['df1']:.0f}, {par['df2']:.4g}) = {cs.fmt_num(par['f'])}, {cs.fmt_p(par['p'])}; "
            f"levels F({lev['df1']:.0f}, {lev['df2']:.0f}) = {cs.fmt_num(lev['f'])}, {cs.fmt_p(lev['p'])}; "
            f"flatness F({flat['df1']:.0f}, {flat['df2']:.0f}) = {cs.fmt_num(flat['f'])}, {cs.fmt_p(flat['p'])}"),
    "statistics": [{"key": "parallel_f", "label": "F (parallelism)", "value": par["f"]}, {"key": "parallel_p", "label": "p (parallelism)", "value": par["p"], "format": "p"},
                   {"key": "levels_p", "label": "p (levels)", "value": lev["p"], "format": "p"}, {"key": "flat_p", "label": "p (flatness)", "value": flat["p"], "format": "p"}],
    "tables": [
        {"key": "tests", "title": "Profile tests",
         "columns": [{"key": "test", "label": "Test", "type": "string"}, {"key": "stat", "label": f"{NAMES[test]} / T²", "type": "number"},
                     {"key": "f", "label": "F", "type": "number"}, {"key": "df1", "label": "df1", "type": "number"}, {"key": "df2", "label": "df2", "type": "number"},
                     {"key": "p", "label": "p", "type": "pvalue"}],
         "rows": tests_rows},
        {"key": "means", "title": "Group profiles (means)",
         "columns": [{"key": "group", "label": g, "type": "string"}, {"key": "n", "label": "n", "type": "integer"}]
                    + [{"key": f"m{j}", "label": m, "type": "number"} for j, m in enumerate(measures)],
         "rows": [dict({"group": lv, "n": int(res["ns"][i])}, **{f"m{j}": float(res["means"][i, j]) for j in range(dims)}) for i, lv in enumerate(levels)]},
    ],
    "effectSizes": [{"key": "parallel_eta_p", "label": "Partial η² (parallelism)", "value": par["eta"], "method": "multivariate partial η² of the group × measure interaction", "magnitude": size, "ruleSet": "Cohen (1988)"},
                    {"key": "levels_eta_p", "label": "η² (levels)", "value": lev["eta"], "method": "SS between / SS total of the row means"}],
    "assumptions": assumptions,
    "warnings": warnings,
    "notes": ["Successive-difference contrasts; the parallelism test is the multivariate (sphericity-free) test of the group × measure interaction, flatness uses the pooled within-group covariance (N − k df)."],
    "values": values,
    "charts": [cs.chart("profile", "profile-plot", f"Mean profiles by {g} ({conf:.0%} intervals)", {
        "measure": cs.col("Measure", plot["measure"], "categorical", levels=measures),
        "mean": cs.col("Mean", plot["mean"], "numeric"),
        "group": cs.col(g, plot["group"], "categorical", levels=levels),
        "low": cs.col("CI low", plot["low"], "numeric"),
        "high": cs.col("CI high", plot["high"], "numeric")})],
})

Find the profile plot, then read the three rows in order:

  • Parallel: p = .930, so the data are compatible with lines of the same shape.
  • Levels: F(1, 88) = 22.7, p < .001, with partial η2\eta^2 = 0.21.
  • Flat: p = .697.

How would you say this in one sentence to a colleague?

05

A different pattern

Predict

Predict first

With 16 people across three pre-tests, parallel has p = .143.

Levels has p = .227 and flat has p < .001. Which do these values support?

Groups differ in levelScores change across the measuresBoth
Reveal

Scores change across the measures: flatness is hard to reconcile with the data. Levels and parallelism are compatible with no difference, but with only this many people those tests have little power. Check the plot before you call the groups alike.

06

More groups, more measures

Reflect

With three treatments and five measures, parallel has p = .901, levels has p = .046 and flat has p = .002.

Which comparison would you report first here, and which would you describe only with the plot? Would your answer change if parallel had been small?

07

Check your understanding

Checkpoint

Check yourself

The parallelism test is equivalent to which effect in a repeated-measures ANOVA?

Show the answer

Answer: c

Lines with different shapes mean that the difference between groups depends on the measure, which is an interaction.

Check yourself

Put the reading steps in order.

  1. 1Read the parallelism test
  2. 2Report effect sizes and describe any crossing
  3. 3Plot each group's means across the measures
  4. 4Read levels and flatness, if the lines are about parallel

Show the answer

The order:

  1. Plot each group's means across the measures
  2. Read the parallelism test
  3. Read levels and flatness, if the lines are about parallel
  4. Report effect sizes and describe any crossing

The plot and parallelism decide how to read everything else.

Check yourself

You want to compare groups on height in cm, weight in kg and blood pressure in mmHg. Is profile analysis a good fit?

Show the answer

Answer: b

Differences between measures only make sense on a shared scale. For unrelated outcomes, use MANOVA; if you must standardize first, a "shape" is only a shape of z-scores.

08

Do it in CodeSplash

In the app

List Measures (in order) and choose Groups. Parallelism statistic defaults to Pillai's trace.

Python
import pandas as pd
from statsmodels.multivariate.manova import MANOVA

df = pd.read_csv("scores.csv")
df["d1"] = df["m2"] - df["m1"]
df["d2"] = df["m3"] - df["m2"]
# Parallelism: MANOVA on the successive differences
print(MANOVA.from_formula("d1 + d2 ~ group", data=df).mv_test())
R
# install.packages("profileR")
df <- read.csv("scores.csv")
fit <- profileR::pbg(data = df[c("m1", "m2", "m3")], group = df$group)
summary(fit)
09

Recap

Recap
  • Profile analysis asks three questions of one plot: parallel, levels, flat.
  • Read parallelism first, since a crossing changes the meaning of the other two.
  • It needs ordered measures on a shared scale, and it doesn't assume sphericity.
  • Large p-values in small samples don't show that lines are parallel or level.

Concepts in this lesson