Skip to content

BCompare groups · Guide test 154

Wilks lambda MANOVA test

Tests multivariate model effects using a ratio of residual and total determinant measures.

Runs in CodeSplashPython example validatedR example validated

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 = Wilks' lambda.

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 · Wilks lambda MANOVA test

3
15
0.40
0.25
0.40
1.00

Above 1 the later groups are more spread out (unequal covariance matrices).

0.050

Your data

Simulated with known truth

3 groups on two measurements; crosses mark the group means.

If H₀ were true

F = 1.35
  1. The reference: how F varies across samples when H₀ is true (F approximation).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .259).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Λ=∣E∣∣E+H∣=∏i11+λi\Lambda = \dfrac{|\mathbf E|}{|\mathbf E + \mathbf H|} = \prod_i \dfrac{1}{1+\lambda_i}

With your numbers

Λ=1(1+0.14)(1+0.000093)=0.88,F=1.35\Lambda = \dfrac{1}{(1+0.14)(1+0.000093)} = 0.88,\qquad F = 1.35
H\mathbf H
between-group sums of squares and cross-products
E\mathbf E
within-group sums of squares and cross-products
λi\lambda_i
eigenvalues of E⁻¹H
Λ\Lambda
the Wilks statistic

The verdict

F(4, 82) = 1.35, p = .259, Λ = 0.88

p > α = .050: compatible with H₀

Effect size: Wilks's lambda Λ = 0.880

Small Λ rejects: the within-group scatter is a small part of the total. All four statistics agree when there are two groups.

Statistic
1.349
p-value
0.2589
Wilks lambda MANOVA test on 3 groups of 15 rows on two variables: F(4, 82) = 1.35, p = .259, Λ = 0.88. The p-value is above α = .050, so the data are compatible with H0.

Wilks lambda MANOVA test on 3 groups of 15 rows on two variables: F(4, 82) = 1.35, p = .259, Λ = 0.88. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: the tested coefficient/mean-vector 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

Λ=∣E∣∣E+H∣=∏j=1s(1+λj)−1\Lambda=\frac{|E|}{|E+H|}=\prod_{j=1}^{s}(1+\lambda_j)^{-1}

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

Fit a multivariate linear model, build residual and hypothesis sums-of-products matrices for an estimable contrast, and compute the residual-to-total determinant ratio. A stable generalized-eigenvalue or log-determinant calculation avoids directly multiplying poorly conditioned eigenvalues.

Estimated and nuisance parameters

Estimate the coefficient matrix and common residual covariance. The hypothesis matrix depends on the prespecified contrast and fitted coefficients; response dimension, contrast rank and residual degrees of freedom determine calibration.

Settings and design choices

Choose the design, contrast matrix, sums-of-squares convention for unbalanced designs, alpha and documented F approximation. Rank tolerances are numerical settings and cannot legitimately rescue a singular inferential design.

Fitting and adaptation

Refit the multivariate model for each new dataset and reconstruct E and H for the intended hypothesis. If adapting the response set or model formula, recalculate all ranks and degrees of freedom and account for selection. No neural fine-tuning occurs. Report lambda, transformed F, both degrees of freedom and whether the reference is exact or approximate.

Sensitivity and robustness

Highly correlated outcomes make determinants unstable. Unequal covariance, imbalance, heavy tails and within-subject dependence can invalidate classical inference. Different software defaults may test different contrasts. With a one-degree-of-freedom effect all four classical MANOVA F conversions coincide, so these are not four independent confirmations.

How to use and calibrate

Small Λ rejects. Rao’s approximation sets r=√[(p²q²−4)/(p²+q²−5)] when p²+q²>5, otherwise r=1; df1=pq, df2=r[v−(p−q+1)/2]−(pq−2)/2; F=(Λ^(−1/r)−1)df2/df1. Use exact special cases where available.

Example application

Test a treatment’s joint effect on several correlated outcomes.

Interpretation and pitfalls

Watch out

The F conversion is generally approximate; singular matrices and unequal covariances can invalidate it.

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.

Python · native

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
============================================================
R

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="Wilks"))
Output
          Df   Wilks approx F num Df den Df   Pr(>F)    
g          1 0.78293   7.9481      3     86 9.73e-05 ***
Residuals 88                                            
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Sources

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 154, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT154.