BCompare groups · Guide test 157
Roy largest root MANOVA test
Tests multivariate effects using the strongest canonical separation among responses.
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 = Roy's largest root.
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 · Roy largest root 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 upper bound).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .069).
- 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 Roy statistic
The verdict
F(2, 42) = 2.85, p = .069, θ = 0.14
p > α = .050: compatible with H₀
Effect size: Roy's largest root θ = 0.136
Roy's F is an upper bound, so its p-value is optimistic; it is most powerful when the groups differ along one direction. All four statistics agree when there are two groups.
- Statistic
- 2.853
- p-value
- 0.0689
Roy largest root MANOVA test on 3 groups of 15 rows on two variables: F(2, 42) = 2.85, p = .069, θ = 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
Compute the largest generalized eigenvalue of H against E, emphasizing the strongest multivariate separation direction. The common software F conversion is a bound in multi-root problems, not generally the exact tail probability of the largest-root distribution.
Estimated and nuisance parameters
Estimate model coefficients and common residual covariance, then derive the maximizing canonical direction and root. That direction is selected from the same data; treating it as a prespecified univariate contrast ignores selection.
Settings and design choices
Prespecify this criterion when a concentrated alternative is scientifically plausible, and state bound versus exact/simulated calibration. Fix responses and model contrasts; post hoc searching among MANOVA criteria adds a selection problem.
Fitting and adaptation
For new data refit the model and recompute the largest root. If an exact or simulation-based root reference is needed, generate the correct multivariate null/design and repeat the maximization. There is no fine-tuning stage. Report when software supplies an optimistic significance bound, and validate any discovered canonical direction on independent data before substantive interpretation.
Sensitivity and robustness
The criterion ignores weaker roots and may lose sensitivity to distributed effects. Collinearity can make the largest root unstable. The source notes that all four criteria agree for one-df effects, while multi-root Roy results need special care; a small bound is not automatically an exact omnibus p-value.
How to use and calibrate
A common bound uses F=[(v−r+q)/r]Θ, df1=r=max(p,q),df2=v−r+q. For multiple roots this can yield an optimistic significance bound rather than an exact p value; use an exact/simulated root distribution when required.
Example application
Look for an effect concentrated in one strong canonical direction.
Interpretation and pitfalls
Watch out
It ignores smaller roots. Do not describe the usual multi-root F bound as an exact omnibus p value.
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="Roy"))
Output
Df Roy 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 157, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT157.