Skip to content

Levene's test

Maurice HT Ling edited this page Aug 13, 2021 · 2 revisions

Purpose: To test whether the variances of 2 or more samples are equal.

Null hypothesis: Variances of all samples are equal.

Alternate hypothesis: At least one sample variance is not equal to the rest.

Note: Levene's test caters to non-normal samples.

Code:

>>> from scipy import stats
>>> X1 = [9.07, 8.97, 6.41, 3.03, 1.19, 2.67, 2.81, 9.2]
>>> X2 = [3.82, 8.26, 5.99, 3.81, 1.07, 5.06, 5.66, 4.47]
>>> X3 = [8.46, 7.46, 4.48, 1.41, 3.16, 1.77, 5.33, 6.61]
>>> result = stats.levene(X1, X2, X3, center='mean')
>>> print("Statistic = %.3f" % result[0])
Statistic = 3.104
>>> print("p-value = %.3f" % result[1])
p-value = 0.066

If the parameter center is changed to median or trimmed (for trimmed mean), Levene's test becomes Brown-Forsythe test.

Reference

  1. Levene H. 1960. Robust tests for equality of variances. In Olkin I, Hotelling H, et al. (eds.). Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling. Stanford University Press. pp. 278–292.
  2. Brown MB, Forsythe AB. 1974. Robust tests for the equality of variances. Journal of the American Statistical Association 69, 364–367.
Clone this wiki locally