BCompare groups · Guide test 156
Hotelling–Lawley trace MANOVA test
Tests multivariate effects using the sum of characteristic roots of the hypothesis and error matrices.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- MANOVA / MANCOVA — Do several outcomes jointly differ across groups (adjusting for covariates)?
In MANOVA / MANCOVA, choose Test statistic = Hotelling–Lawley trace.
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Hotelling–Lawley trace MANOVA test
Above 1 the later groups are more spread out (unequal covariance matrices).
Your data
Simulated with known truth3 groups on two measurements; crosses mark the group means.
If H₀ were true
- The reference: how F varies across samples when H₀ is true (F approximation).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .256).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- between-group sums of squares and cross-products
- within-group sums of squares and cross-products
- eigenvalues of E⁻¹H
- the Hotelling-Lawley statistic
The verdict
F(4, 80) = 1.36, p = .256, U = 0.14
p > α = .050: compatible with H₀
Effect size: Hotelling–Lawley trace U = 0.136
Hotelling–Lawley adds up all the eigenvalues; it is powerful when the group differences spread over several directions. All four statistics agree when there are two groups.
- Statistic
- 1.359
- p-value
- 0.2555
Hotelling–Lawley trace MANOVA test on 3 groups of 15 rows on two variables: F(4, 80) = 1.36, p = .256, U = 0.14. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: tested multivariate contrasts are zero.
Assumptions
Independent multivariate normal errors with a common nonsingular covariance, a correctly specified full rank multivariate linear model, and estimable hypothesis contrasts.
Formula
Parameters and notation
H and E are hypothesis and residual sums-of-squares-and-products matrices. λj are the s=min(p,q) nonzero eigenvalues of E⁻¹H; p outcomes,q hypothesis df,v residual df.
Structure of the method
Estimate multivariate model error and hypothesis cross-products and sum generalized eigenvalues of the hypothesis relative to error. The sum weights strong canonical departures more heavily than Pillai’s bounded fractions; numerical linear algebra should avoid an explicit inverse when possible.
Estimated and nuisance parameters
The fitted coefficient matrix and residual covariance are nuisance estimates. Eigenvalues are derived from the fitted model. Response dimension, hypothesis rank and error degrees of freedom determine the applicable reference approximation.
Settings and design choices
Specify contrasts, response set, design/sums-of-squares convention and which Hotelling–Lawley F approximation is used. Different accepted approximations can produce different finite-sample p-values even when the raw trace agrees.
Fitting and adaptation
Refit E and H on new data, rerun the decomposition and recompute the approximation with current degrees of freedom. A changed model or response basis requires a corresponding new hypothesis, not neural adaptation. Report raw trace, approximation name, F and both degrees of freedom; evaluate outcome-specific effects only through justified follow-up inference.
Sensitivity and robustness
Near-singular residual covariance can create very large roots and unstable sums. Heterogeneous covariances, imbalance and dependent observations compromise calibration. Strong effects in one direction can dominate the trace, so inspect canonical or scientifically defined contrasts rather than interpreting a global rejection as equal changes in all outcomes.
How to use and calibrate
Use a documented Hotelling–Lawley F approximation or exact special case. One classical form uses m=(|p−q|−1)/2,a=(v−p−1)/2: F=2(sa+1)U/[s²(2m+s+1)], df1=s(2m+s+1),df2=2(sa+1), when applicable.
Example application
Detect a multivariate effect distributed across canonical directions.
Interpretation and pitfalls
Watch out
Different software may use improved F approximations. Report the statistic, approximation and both degrees of freedom.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
R selects the named criterion; Python prints all four MANOVA criteria, so read the row matching this entry. Two groups yield only one nonzero latent root.
Validated — Executed successfully in the validation environment · needs numpy, scipy, statsmodels
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
X=rng.normal(size=(40,3));Y=rng.normal(.3,1,size=(50,3))
from statsmodels.multivariate.manova import MANOVA
Z=np.vstack([X,Y]);g=np.r_[np.zeros(len(X)),np.ones(len(Y))]
print(MANOVA(Z,np.column_stack([np.ones(len(Z)),g])).mv_test())
Output
Multivariate linear model
============================================================
------------------------------------------------------------
x0 Value Num DF Den DF F Value Pr > F
------------------------------------------------------------
Wilks' lambda 0.9957 3.0000 86.0000 0.1240 0.9457
Pillai's trace 0.0043 3.0000 86.0000 0.1240 0.9457
Hotelling-Lawley trace 0.0043 3.0000 86.0000 0.1240 0.9457
Roy's greatest root 0.0043 3.0000 86.0000 0.1240 0.9457
------------------------------------------------------------
------------------------------------------------------------
x1 Value Num DF Den DF F Value Pr > F
------------------------------------------------------------
Wilks' lambda 0.9185 3.0000 86.0000 2.5421 0.0616
Pillai's trace 0.0815 3.0000 86.0000 2.5421 0.0616
Hotelling-Lawley trace 0.0887 3.0000 86.0000 2.5421 0.0616
Roy's greatest root 0.0887 3.0000 86.0000 2.5421 0.0616
============================================================Validated — Executed successfully in the validation environment · needs Base/standard library
set.seed(2026)
X<-matrix(rnorm(120),ncol=3);Y<-matrix(rnorm(150,mean=.3),ncol=3)
Z<-rbind(X,Y);g<-factor(rep(1:2,c(nrow(X),nrow(Y))));print(summary(manova(Z~g),test="Hotelling-Lawley"))
Output
Df Hotelling-Lawley approx F num Df den Df Pr(>F) g 1 0.27726 7.9481 3 86 9.73e-05 *** Residuals 88 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Sources
- R MANOVA test documentationstat.ethz.ch
- summary.manovastat.ethz.ch
- Statistics guide v4 (historical):
- Python: Executed successfully in the validation environment · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Unavailable local dependencies: statsmodels. Python: Not run in the reference's review: Unavailable local dependencies: statsmodels. No installation attempted. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 156, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT156.