Português

Levene’s test

Variances (spread) · Three or more independent groups · reference distribution: F(k−1, N−k)

When to use it

Check whether two or more groups have the same variance, for example before an ANOVA.

Null hypothesis

All variances are equal.

Assumptions

Test statistic

W = \dfrac{(N - k) \sum_j n_j (\bar{Z}_j - \bar{Z})^2}{(k - 1) \sum_j \sum_i (Z_{ij} - \bar{Z}_j)^2}

How to report it

F(2, 42) = 1.36, p = .27

In R and Python

R
library(car)
leveneTest(y ~ group, data = df, center = mean)  # center = median is Brown-Forsythe
Python
stats.levene(a, b, c, center="mean")  # "median" is Brown-Forsythe

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Variances (spread). They compare how spread out the data are, not the center. Useful on their own, as in quality control, and to check the equal-variance assumption of other tests.

Three or more independent groups. Several groups of different individuals, tested at once: one test per pair would inflate the type I error.

In the decision tree

  1. What do you want to do? Compare groups, or one group with a reference value
  2. What kind of response did you measure? The spread, not the center
  3. How many groups or measurements? Two independent groups
  4. Are the data normal? No, or it cannot be assured
  1. What do you want to do? Compare groups, or one group with a reference value
  2. What kind of response did you measure? The spread, not the center
  3. How many groups or measurements? Three or more independent groups
  1. What do you want to do? Check an assumption or the distribution of the data
  2. What do you want to check? Whether the groups have the same variance

It also appears alongside other tests:

Open the decision tree