Levene’s test
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical inference.
In statistical inference, Levene’s test is a test of equal variances formed by an analysis of variance on absolute deviations from each group’s centre. It tests equality of variances by replacing each observation with its absolute deviation from a centre of its own group, and then comparing those deviations with a one-way analysis of variance. The centre may be the group mean, the group median, or a trimmed mean. The three choices do not test the same finite-sample statistic, and on a skewed group they need not reach the same decision.
Levene’s test
| Fact | Value |
|---|---|
| Topic | Statistical inference |
| Listed on | Statistical inference |
Motivating example
Three groups of three observations are The first two groups are symmetric and have the same spacing. The third has the same two small values a short step apart and one value, , far to the right. An ordinary one-way analysis of the raw numbers would ask whether the means differ, and it would do so under a common variance. The question here is that common variance. Levene’s test answers it by running the one-way analysis on the absolute deviations from a group centre. Using the mean, the resulting is , just above the upper point of on degrees of freedom. Using the median, the is , and the test does not reject. The same three groups, with replaced by , give for the mean-centred statistic. One observation, and the choice of centre, both decide the conclusion.
One-way analysis of variance on absolute deviations
Let be observation in group , with , , and . Choose a centre for each group and set . Write for the mean of the in group and for the mean of all of them. The Levene statistic is the one-way statistic of the : The numerator measures how far the groups’ typical absolute deviations are from one another. The denominator measures the scatter of those absolute deviations inside the groups. Large is evidence against equal variances. Under the equal-variance null, and with the usual normal-theory reference for this ratio, is compared with the upper point of the distribution on degrees of freedom. That critical value is the upper point . The mean-centred form is this statistic applied to .[1] It is not exactly an random variable, because the absolute deviations are not normal and are not independent within a group.[2]
Three centres are in use. The original statistic takes to be the group mean. Replacing that mean by a more robust centre, for example the group median, puts in place of in the same statistic. The trimmed mean is the third centre. The three definitions change both the robustness of the test and its power. Robustness here means that equal variances are not declared unequal merely because the data are non-normal. Power means that unequal variances are detected when they are present.[2] [1]
A one-way analysis of variance writes and compares a between-group sum of squares with a within-group sum of squares.[3] Applied to the , that comparison treats the groups as the treatments and the absolute deviations as the observations. Rejection then says that the groups differ in the location of , which is the sense in which the scale differs. It does not say which group is more variable, and it does not by itself name a transformation.
What a rejection changes about the next comparison
A rejection says that a single variance is not a fair description of all the groups. It does not order the groups. In the mean-centred example the third group’s absolute deviations are the large ones, which is visible from against , but that comparison of the means is descriptive. The test itself is one on all groups.
The procedures that used the rejected assumption are the ones to set aside. A two-sample statistic that pools the two sample variances assumes those variances are equal. If that assumption is not tenable, the comparison of the two means and uses the unpooled statistic where and are the sample sizes and and are the sample variances. The degrees of freedom are the Welch–Satterthwaite values used for a Welch interval. If the two standard deviations cannot be treated as equal, the comparison uses this unpooled statistic rather than a pooled variance. A pooled error mean square in a larger layout is the same assumption.[4] [5]
A non-rejection does not prove the variances equal, any more than a large Shapiro–Wilk -value proves normality. With and the reference on degrees of freedom is wide: the median-centred has tail probability . That is a failure to detect a difference in scale, not a demonstration that the scales match. The mean-centred rejection at is itself close to . Reporting and , rather than only the word “significant”, shows how little room there was.
Mean, median, and trimmed mean
As summarised in the NIST/SEMATECH account, sampling comparisons put the trimmed mean ahead when the underlying distribution is Cauchy, and the median ahead when it is chi-squared on degrees of freedom, a skewed law. The mean-centred form has the best power of the three when the distribution is symmetric with tails that are not extreme. No single centre wins for every distribution. When the shape is unknown, the median is the centre recommended as a default: it keeps the type I behaviour under a range of non-normal laws and still has power. If the shape is known to be symmetric and not heavy-tailed, the mean is the more powerful centre.[1]
The contrast with the other classical variance tests is the reason for going through absolute deviations at all. Bartlett’s test of several variances is sensitive to departures from normality. If the samples are non-normal, the test may simply be testing for non-normality.[6] Levene’s test is an alternative to Bartlett’s test, and it is less sensitive to departures from normality.[1] The two-sample variance-ratio test uses and compares that ratio with an reference.[7] A Levene statistic can be computed for two groups; it is still the ratio of the , not that ratio of sample variances.
leveneTest in the car package implements the same analysis. The default centre is the median. Setting the centre to the mean recovers the original statistic. Passing trim = 0.1 with that mean centre uses a trimmed mean. The default is the resistant choice, not the historically first one, and a published is not interpretable until the centre is named.[8]
Name the centre, then choose the comparison of means
State , the , the centre, , the degrees of freedom, and the reference probability. “Levene’s test was significant” leaves out the choice that, in the worked example, changes the decision. In leveneTest the call leveneTest(y, group) uses the median. The call with center = mean is the original statistic. The two values and are those two calls on these nine numbers.[8]
If the scientific question is a difference of means and has rejected a common variance, the follow-up is the unpooled comparison above, not a pooled and not a further transformation chosen because it makes smaller. A transformation changes the scale on which the means are compared. That may be the right scientific step, but it is not what the rejection by itself instructs. If the question is the variances, the on the absolute deviations is already the answer, and the next description is which groups’ deviations are large.
Bartlett’s test remains the more powerful variance comparison when there is strong evidence that the data are nearly normal. Levene’s test is the one to use when that evidence is absent or when a Shapiro–Wilk check on the residuals has already made normality doubtful. The two checks are not substitutes: one is about shape, the other is about scale.[1] [6]
Three groups, two centres
The groups are those in the motivating example, , , . The analysis-of-variance therefore has and degrees of freedom, and the upper point of that law is .
The group means are , and . The absolute deviations from those means are Their group means are , and . The nine deviations add to , so the grand mean is . The between-group sum of squares is Inside the first group the deviations from are , and , and the sum of squares is . The second group contributes the same . Inside the third group the deviations from are , and , and the sum of squares is . The within-group sum of squares is . Then Since , the mean-centred test rejects equal variances at . The upper-tail probability is .
The group medians are , and . Groups and are symmetric, so their absolute deviations do not change. Group has median , and its absolute deviations are , and . The group means of the deviations are , and , and the grand mean is . The between-group sum of squares is and the within-group sum of squares is , so The upper-tail probability is . The median-centred test does not reject. leveneTest with center = mean returns on degrees of freedom, and with the default median centre it returns . The hand arithmetic and the function agree.[8]
The two calculations use the same observations and the same reference. They differ in for the skewed group. The mean of is , pulled toward the outlier, and the absolute deviations are moderately spread. The median stays at , and the absolute deviations put almost all of the within-group square on the single large residual. That inflates the denominator of and the statistic falls from to . Choosing the centre is part of the test. On this sample it changes the decision.
Replace by , so the third group is . Every group is then an arithmetic progression with the same spacing, and the absolute deviations from each group mean are . The three groups of are identical, the between-group sum of squares is , and . The mean-centred rejection was carried by the value . A variance test that ignores that fact has reported a property of one observation.
Your turn. Two groups are and . The centres are the group means, and . The absolute deviations are and . Compute the mean-centred . The upper point of on degrees of freedom is . Does the test reject?
The group means of the absolute deviations are and , and the grand mean is . The between sum of squares is and the within sum of squares is . Then . Since , the mean-centred test does not reject equal variances at .
The reference is an approximation to a ratio of absolute deviations
The statistic is exactly the one-way of the constructed variables . The comparison of with treats that ratio as if it had the normal-theory distribution. The are absolute deviations, hence skewed and dependent within a group, because the centre is computed from the same observations. The tail is an approximation to the null distribution of this ratio, not a theorem that is normal. The case for the procedure is that the approximation is less easily wrecked by a non-normal than Bartlett’s chi-squared form. That is an empirical claim about type I behaviour, taken from the sampling comparisons, not an exact null.[1]
With the median of a group is the middle observation, so one of the three absolute deviations is zero whenever the median is unique. The within-group sum of squares is then carried by the other two points. That is visible in the median-centred third group, where dominates . With a larger group the centre is estimated from more observations, and one wild point is a smaller share of the within-group sum of squares. The worked example shows the effect of the centre at . It does not estimate power at large .
The rejection rule is greater than the upper point of .[1]
The variance ratio, the pooled comparison, and the shape check
The F test for equal variances is the two-sample ratio . One-way analysis of variance is both the motive for checking a common variance and the arithmetic applied to the absolute deviations. A Welch interval is the two-sample comparison of means that does not pool the variances. The two-sample test is that comparison in either its pooled or its unpooled form; which form is legal depends on the variance conclusion. The Shapiro–Wilk test concerns normality rather than scale. A doubt it raises about the residuals is a reason to prefer Levene’s variance check to Bartlett’s.
Check yourself
1. Two new groups are and . Using the group means as centres, what is ? The upper point of on degrees of freedom is .
The means are and . The absolute deviations are and , with group means and and grand mean . The between sum of squares is and the within sum of squares is , so . Since , the mean-centred test rejects at .
2. For the same two groups, and , use the group medians as centres. What is , and does the test reject? The upper point is again .
The medians are and . The absolute deviations are and . The between sum of squares is and the within sum of squares is , so . Since , the median-centred test does not reject. The choice of centre changes the decision.
3. The mean-centred test has rejected a common variance, and the next question is a difference between two of the group means. Which two-sample statistic does not use the rejected assumption?
The unpooled statistic, divided by the square root of , with Welch–Satterthwaite degrees of freedom. The pooled two-sample statistic uses one variance for both groups.
The mean in 1960, the median and the trimmed mean in 1974
The mean-centred statistic is the analysis of variance of absolute deviations from the group means, the form dated to 1960. Replacing those means by the group medians is the 1974 modification. The comparison of the mean, the median and the trimmed mean, as summarised in the NIST/SEMATECH account, is the guidance that the trimmed mean behaves best for a heavy-tailed symmetric law such as the Cauchy, the median best for a skewed law such as , and the mean best for symmetric distributions with moderate tails. When the shape is not known in advance, the median is the robust default drawn from that summary.[2] [1] The software default is the same median centre.[8]
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b c d e f g h a. (§1.3.5.10) b. (§1.3.5.10) c. (§1.3.5.10) d. (§1.3.5.10) e. (§1.3.5.10) f. (§1.3.5.10) g. (§1.3.5.10) h. (§1.3.5.10) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.10: Levene Test for Equality of Variances. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm
- ^ a b c a. (§1, equation (3)) b. (§1) c. (§1, equation (3)) Gastwirth, Joseph L., Gel, Yulia R. & Miao, Weiwen (2009). The Impact of Levene's Test of Equality of Variances on Statistical Theory and Practice. Statistical Science, 24(3), 343–360. https://doi.org/10.1214/09-STS301
- ^ (pp. 399–400) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
- ^ (§1.3.5.3) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.3: Two-Sample t-Test for Equal Means. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm
- ^ (§7.3.1) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §7.3.1: Comparison of Two Means. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/prc/section3/prc31.htm
- ^ a b a. (§1.3.5.7) b. (§1.3.5.7) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.7: Bartlett's Test. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/eda/section3/eda357.htm
- ^ (§1.3.5.9) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.9: F-Test for Equality of Two Variances. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/eda/section3/eda359.htm
- ^ a b c d a. (Arguments, `center` and `...`) b. (Usage and Arguments, `center`) c. (Usage, `center`) d. (Arguments, `center`) Fox, John (2026). Levene's Test (car package documentation for leveneTest). Comprehensive R Archive Network. https://search.r-project.org/CRAN/refmans/car/html/leveneTest.html
Cite this page
StatWiki (2026). "Levene's test." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/levene-s-test.html
@misc{statwiki_levene_s_test,
author = {{StatWiki}},
title = {{Levene's test}},
year = {2026},
url = {https://www.statwiki.io/articles/levene-s-test.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}