From Repeated Measurements to Mauchly’s W
Mauchly’s test turns a covariance pattern into a test of sphericity. The calculation is easiest to follow in coordinates that describe only contrasts among the repeated conditions. In those coordinates, sphericity means that every direction has the same variance and distinct directions have zero covariance. Mauchly’s \(W\) summarizes how close the observed covariance matrix is to that pattern.
The numerical steps are manageable, but the dimensions and the sample-size correction matter. The examples below show how to form the contrast covariance matrix, calculate \(W\), and use the approximate chi-square reference distribution.
The all-ones vector \(\mathbf{1}\) represents a common shift shared by every condition. Contrasts remove that common shift, so the \(q\)-dimensional contrast space contains the information relevant to sphericity. With orthonormal contrast rows, sphericity is equivalent to the population contrast covariance matrix being a positive scalar multiple of the identity matrix: all \(q\) contrast variances are equal and all covariances between distinct orthonormal contrasts are zero.
How the Statistic and Approximation Work
The determinant of a covariance matrix is the product of its eigenvalues, while its trace is their sum. If the eigenvalues of \(\mathbf{S}_C\) are \(\lambda_1,\ldots,\lambda_q\), then \(W=\prod_{j=1}^{q}\lambda_j/\{(\sum_{j=1}^{q}\lambda_j)/q\}^{q}\). Thus \(W\) compares the product of the eigenvalues with the product they would have if all were equal while keeping their sum fixed.
The inequality follows from the arithmetic–geometric mean inequality: the geometric mean of positive eigenvalues cannot exceed their arithmetic mean. Equality holds only when all eigenvalues are equal. This explains why values of \(W\) near one are consistent with sphericity, while smaller values indicate more unequal variance across contrast directions. The value is unchanged if every entry of the covariance matrix is multiplied by the same positive constant, so \(W\) itself has no measurement units.
For the usual approximate test, the sample size is \(N\), the contrast-space dimension is \(q\), and the statistic is compared with a chi-square distribution with \(q(q+1)/2-1\) degrees of freedom. The test uses the upper tail: small \(W\) gives a larger test statistic and, ordinarily, a smaller p-value.
The assumptions matter to this calculation. The repeated-measurement vectors from different subjects should be independent, and the within-subject vectors are assumed to follow a multivariate normal distribution for the standard approximation. The contrast covariance matrix must be positive definite so its determinant and logarithm are defined. In practice, calculations also presume complete repeated measurements for the subjects included. A small p-value is evidence against the sphericity null under these assumptions; it is not the probability that the null is true.
Worked Calculations
Worked Example: Transforming a Three-Condition Covariance Matrix
Suppose a hypothetical sample of \(N=20\) independent subjects has three repeated measurements, recorded in a common unit. Its sample covariance matrix is
Assume the subject vectors are multivariate normal and that the displayed matrix is positive definite. Use the orthonormal contrast matrix with rows \((1,-1,0)/\sqrt{2}\) and \((1,1,-2)/\sqrt{6}\). Each row sums to zero, each has length one, and their dot product is zero, so these are orthonormal contrasts. Here \(q=2\).
For example, the first contrast variance is \(\{4+5-2(2)\}/2=5/2\). The second is \(\{4+5+4(6)+2(2)-4(1)-4(2)\}/6=25/6\). The covariance between them is \(1/\sqrt{12}\). The determinant and mean diagonal value are
Therefore \(W=(31/3)/(10/3)^2=0.9300\). For \(q=2\), the finite-sample correction is \((2q^2+q+2)/(6q)=1\), and the degrees of freedom are \(2(3)/2-1=2\). The approximate statistic is
The upper-tail p-value from a chi-square distribution with 2 degrees of freedom is approximately \(0.520\). At a \(0.05\) significance level, these hypothetical data do not provide sufficient evidence to reject sphericity. This conclusion is about the test result under its assumptions; it does not establish that the population covariance is exactly spherical.
Worked Example: A Three-Dimensional Contrast Covariance
A hypothetical study has \(N=24\) independent subjects measured in four conditions, so \(q=3\). Suppose the sample covariance matrix is already expressed in orthonormal contrast coordinates:
Assume the subject vectors are multivariate normal and the matrix is positive definite. Its determinant is \(1(2)(4)=8\), and its trace is \(1+2+4=7\). Thus
The correction is \((2(3^2)+3+2)/(6(3))=23/18\). The degrees of freedom are \(3(4)/2-1=5\), and the approximate statistic is
The upper-tail probability for a chi-square distribution with 5 degrees of freedom is approximately \(0.074\). At \(\alpha=0.05\), the result is not statistically significant, so this test does not reject sphericity. The unequal diagonal entries make the observed matrix look non-spherical, but the test decision depends on both the size of that departure and the sample size, not on visual inequality alone.
Worked Example: A Small W and a Strong Test Result
Consider a different hypothetical sample with \(N=30\) independent subjects and \(q=2\) orthonormal contrasts. Suppose its positive-definite sample contrast covariance matrix is
Assume multivariate normal subject vectors. The determinant is \(9\), the trace is \(10\), and the mean diagonal value is \(10/2=5\). Hence
For \(q=2\), the correction is again 1 and \(df=2\). The approximate statistic is
For 2 degrees of freedom, the upper-tail p-value is approximately \(6.14\times10^{-7}\). At \(\alpha=0.05\), reject the sphericity null for this hypothetical setting. The contrast directions have markedly different sample variances, and the approximate test statistic is large relative to its null reference distribution. The result is evidence against sphericity, rather than a measure of how likely the null hypothesis is to be true.
A Reliable Calculation Sequence
Keeping the transformation, the dimension, and the test calibration separate helps prevent arithmetic and interpretation errors. A concise sequence is:
For \(k\) repeated conditions, use \(q=k-1\) orthonormal contrasts spanning the condition-contrast space.
Transform the condition covariance by \(\mathbf{S}_C=C\mathbf{S}_Y C^\mathsf{T}\), or use the supplied matrix if it is already in orthonormal contrast coordinates.
Find the determinant and trace, then divide the determinant by the \(q\)th power of the mean eigenvalue, \(\operatorname{tr}(\mathbf{S}_C)/q\).
Substitute \(N\), \(q\), and \(W\) in the corrected chi-square formula, and use \(q(q+1)/2-1\) degrees of freedom.
Compare the upper-tail p-value with the stated \(\alpha\), and describe whether the data provide evidence against sphericity.
The calculation is undefined as a test when \(q=1\): its degrees of freedom are zero, and \(W=1\) for any positive one-dimensional covariance. This matches the fact that a two-condition repeated-measures design always satisfies sphericity. For \(q\geq2\), report \(W\), the approximate chi-square statistic, its degrees of freedom, the p-value, and the conclusion at the chosen significance level.
Common Mistake
A common error is to use the sample size \(N\) as the degrees of freedom, or to compare the test statistic with the wrong chi-square distribution. The degrees of freedom come from the number of distinct entries in a symmetric \(q\)-by-\(q\) contrast covariance matrix, minus one for the common variance under the null: \(q(q+1)/2-1\). The sample size instead appears in the multiplier of \(-\ln(W)\). For example, with \(q=2\), the test has 2 degrees of freedom whether the sample contains 20 or 30 subjects; changing \(N\) changes the statistic’s calibration, not that degrees-of-freedom formula.
Another tempting but incorrect shortcut is to call any \(W<1\) evidence of a significant violation. Almost every finite-sample covariance matrix will have some unequal eigenvalues, making \(W\) less than one. The test accounts for the size of that departure and the sample size through the approximate reference distribution. Use the p-value and significance level to make the test decision.
Check Your Understanding
Use the definitions and calculation sequence to answer these questions.
- For five repeated conditions, what is the dimension \(q\) of the orthonormal contrast covariance matrix?
- Why must the rows of \(C\) sum to zero and be orthonormal when forming the contrast covariance matrix for this test?
- A positive-definite contrast covariance matrix has eigenvalues \(2\), \(2\), and \(2\). What is \(W\), and why?
- For \(q=3\), calculate the degrees of freedom for the approximate Mauchly test.
- In one sentence, explain why observing \(W<1\) by itself does not justify rejecting sphericity.