# 莱文检验

**莱文检验**（Levene's test）是一种统计检验，其原假设是若干独立样本来自方差相等的总体，这一性质称为方差齐性或同方差性。该检验由霍华德·莱文（Howard Levene）于1960年提出，其做法是对每个观测值与其所在组某一中心值的绝对离差进行单因素方差分析（ANOVA），因此该检验问的是：各组距其组中心的平均距离是否相同。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup><sup> • </sup><sup>[2](https://arxiv.org/abs/1010.0308)</sup>

| 关键事实 | 细节 |
|---|---|
| 用途 | 检验 k 个样本是否具有相等方差，常用于验证方差分析或 t 检验的一个假设<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup> |
| 起源 | 霍华德·莱文（Howard Levene），1960年，载于《概率论与统计学贡献》（*Contributions to Probability and Statistics*），第278–292页<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup><sup> • </sup><sup>[3](https://www.srs.fs.usda.gov/pubs/ja/ja_cain015.pdf)</sup> |
| 检验统计量 | \( W = \frac{N-k}{k-1} \cdot \frac{\sum_{i=1}^{k} N_i(\bar{Z}_{i\cdot}-\bar{Z}_{\cdot\cdot})^2}{\sum_{i=1}^{k}\sum_{j=1}^{N_i}(Z_{ij}-\bar{Z}_{i\cdot})^2} \)，与自由度为 \( k-1 \) 和 \( N-k \) 的 F 分布比较<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup> |
| 中心化选择 | 均值（原始版本）、中位数（布朗-福赛斯变体，Brown-Forsythe variant）或 10% 截尾均值；推荐将中位数版本作为稳健的默认选择<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup> |
| 与巴特利特检验（Bartlett's test）的关系 | 对偏离正态的敏感性低于巴特利特检验；当已知数据接近正态时，巴特利特检验表现更好<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup> |
| 软件默认设置 | SciPy 默认 `center='median'`；R 的 `car` 包默认使用中位数；SPSS 默认报告以均值为中心的版本<sup>[4](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levene.html)</sup><sup> • </sup><sup>[5](https://rdrr.io/rforge/car/man/leveneTest.html)</sup><sup> • </sup><sup>[6](https://rips-irsp.com/articles/10.5334/irsp.82)</sup> |
| 现代注意事项 | 统计学家日益建议跳过预备检验，无条件使用韦尔奇检验（Welch's test），因为两阶段程序无法保护显著性水平<sup>[7](https://onlinelibrary.wiley.com/doi/pdf/10.1348/000711004849222)</sup> |

## 用途与假设

一些常见统计程序，包括方差分析和合并方差 t 检验，都假设所比较各组的方差相等。莱文检验用于在应用此类程序之前检查该假设。假设为：

\[ H_0: \sigma_1^2 = \sigma_2^2 = \cdots = \sigma_k^2 \]
\[ H_a: \sigma_i^2 \neq \sigma_j^2 \text{ 至少存在一对 } (i, j) \]

当统计量 W 超过显著性水平 \( \alpha \) 下自由度为 \( k-1 \) 和 \( N-k \) 的 F 分布的上临界值 \( F_{\alpha,\, k-1,\, N-k} \) 时，检验拒绝原假设。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>

## 检验的工作原理

设变量 Y 的总样本量为 N，划分为 k 个规模为 \( N_i \) 的子组；首先将每个观测值变换为离差分数 \( Z_{ij} \)，即与其所在组某一选定中心的绝对距离。随后，统计量 W 就是对这些 Z 值计算的普通单因素方差分析 F 统计量：它将 Z 的组均值的变异与组内 Z 的变异进行比较。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup><sup> • </sup><sup>[8](https://courses.washington.edu/psy524a/_book/tests-for-homogeneity-of-variance-and-normality.html)</sup>由于该检验依赖于对变换后的离差应用方差分析，它在结构上映射了方差分析本身的统计性质。<sup>[9](https://arxiv.org/abs/2609.17746)</sup>

中心的选择决定了检验的稳健性和功效。这里的稳健性指：当数据不正态但方差实际上相等时，不错误地检测出方差不等的能力；功效指：当方差确实不等时，检测出方差不等的能力。\( Z_{ij} \) 有三种标准定义：<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>

1. \( Z_{ij} = |Y_{ij} - \bar{Y}_{i\cdot}| \)，即与组均值的离差，用于莱文最初的提议。
2. \( Z_{ij} = |Y_{ij} - \tilde{Y}_{i\cdot}| \)，即与组中位数的离差，这一形式称为布朗-福赛斯检验（Brown-Forsythe test）。
3. \( Z_{ij} = |Y_{ij} - \bar{Y}'_{i\cdot}| \)，即与 10% 截尾均值的离差。

## 布朗-福赛斯修正

莱文的原始论文提出使用组均值。1974年，M. B. 布朗（M. B. Brown）和 A. B. 福赛斯（A. B. Forsythe）在《美国统计协会杂志》（*Journal of the American Statistical Association*，第69卷，第364–367页）上发表文章，将该检验扩展到中位数和截尾均值，并通过蒙特卡洛研究表明，替代形式在非正态条件下是稳健的。<sup>[10](https://www.tandfonline.com/doi/abs/10.1080/01621459.1974.10482955)</sup><sup> • </sup><sup>[4](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levene.html)</sup>他们的模拟表明，当底层数据服从柯西分布（Cauchy distribution），即重尾分布时，截尾均值表现最好；对于偏斜数据（如 \( \chi^2_4 \) 分布），中位数表现最好；对于对称、中等尾部分布，均值给出最高的功效。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>

由于没有单一选择对每种分布都最优，通常推荐基于中位数的定义，因为它在对许多类型的非正态数据保持良好稳健性的同时，仍保留良好功效；而若了解底层分布，也可能有理由选择其他选项之一。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>与原始的基于均值的形式相比，中位数版本在数据不正态时表现好得多，而当数据确实正态时只牺牲一点功效。<sup>[11](https://cttir.github.io/tutorials/tutorials/inference/levene-test.html)</sup>基于均值的版本更受离群值影响，而基于中位数的布朗-福赛斯形式对带有离群值的较不正态数据更稳健。<sup>[12](https://academic.oup.com/immunohorizons/article/10/1/vlaf072/8414379)</sup>

## 与其他检验的比较

莱文检验是检验方差相等的若干程序之一。巴特利特检验将各组方差与合并方差比较，在正态性下功效更高，但对偏离正态很敏感，这使其对基因组测量等数据不太有用。<sup>[13](https://pmc.ncbi.nlm.nih.gov/articles/PMC7425781/)</sup><sup> • </sup><sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC6330007/)</sup>F 比值检验和巴特利特检验仅在正态性假设下有效，甚至在轻微偏离时也会失去有效性。<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.82)</sup>

模拟比较已经考察了这些检验的表现。1996年发表在《计算统计与数据分析》（*Computational Statistics & Data Analysis*）上的一项研究，在小到中等样本中比较了七种方差相等性检验，包括莱文检验、经峰度调整和未经峰度调整的巴特利特检验、博克斯-安德森检验（Box-Andersen test）以及三种刀切检验（jackknife test）。研究发现，莱文检验和一种刀切检验是稳健的，而在稳健程序中，莱文检验的自助法版本往往具有最高功效。<sup>[15](https://www.sciencedirect.com/science/article/pii/0167947395000542)</sup>后来一项针对 DNA 甲基化数据的比较发现，布朗-福赛斯检验和基于截尾均值的莱文检验在48个模拟场景中的几乎所有场景里都保持名义第一类错误率，同时具有相对较高的功效。<sup>[16](https://pmc.ncbi.nlm.nih.gov/articles/PMC4684215/)</sup>一项针对九种同质性检验的析因方差分析模拟同样发现，在第一类错误得到控制的条件下，布朗-福赛斯检验和自助法布朗-福赛斯检验始终具有更高的功效。<sup>[17](https://www.tandfonline.com/doi/abs/10.1080/00220973.2020.1789833)</sup>

## 作为预备检验的用途及其批评

在实践中，莱文检验常在进行 t 检验或方差分析之前运行；若结果显著，分析者会转向韦尔奇检验等分离方差方法。这种两阶段程序已受到统计学上的批评。卡尔顿大学（Carleton University）的心理学家兼统计学家唐纳德·W. 齐默尔曼（Donald W. Zimmerman）的模拟表明，先做莱文预备检验、再使用学生合并方差 t 检验（Student pooled-variances t test）或韦尔奇分离方差 t 检验（Welch separate-variances t test），都无法保护显著性水平，而且通常使情况更糟；当样本量小、方差差异轻微而非极端、显著性水平更严苛时，第一类错误率的扭曲最大。最好的保护是：只要样本量不等，就无条件使用分离方差检验。<sup>[7](https://onlinelibrary.wiley.com/doi/pdf/10.1348/000711004849222)</sup>

进一步的问题是，条件选择的错误率取决于莱文检验本身的功效：当该功效低时，程序表现得像学生 t 检验；当功效高时，则像韦尔奇检验，因此实际最常执行的检验，可能正是错误率不正确的那个。<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.82)</sup>据此，德拉克尔及其同事（Delacre et al.）认为，被广泛推荐的两步法——由莱文检验决定使用学生 t 检验还是韦尔奇 t 检验——不应使用，韦尔奇检验应成为默认方法。<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.82)</sup>

## 软件实现

该检验可在主流统计环境中使用。在 SciPy 中，`scipy.stats.levene` 接受不同长度的样本，并提供 `center='mean'`、`'median'` 或 `'trimmed'`，默认是 `'median'`，截尾变体的截尾比例为 0.05；文档建议偏斜分布用中位数，对称中等尾部分布用均值，重尾分布用截尾均值。<sup>[4](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levene.html)</sup>在 R 中，`car` 包的 `leveneTest` 默认 `center=median`，传入 `center=mean` 可复现原始莱文检验。<sup>[5](https://rdrr.io/rforge/car/man/leveneTest.html)</sup>在 SPSS 中，所报告的莱文检验默认以均值作为中心，当底层数据对称时，这是功效最高的选择。<sup>[6](https://rips-irsp.com/articles/10.5334/irsp.82)</sup>在 STATA 中，莱文检验输出中的 w50 统计量给出布朗-福赛斯结果；在 R 中，`lawstat` 包的 `levene.test` 接受 `location="median"`。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC10151260/)</sup>

## 计算示例

NIST《工程统计手册》（NIST Engineering Statistics Handbook）用 GEAR.DAT 数据集说明该检验：十个批次，每批十次齿轮直径测量，共100次测量。使用基于中位数的版本检验 \( H_0: \sigma_1^2 = \cdots = \sigma_{10}^2 \)，得到 W = 1.705910，自由度为 \( k-1 = 9 \) 和 \( N-k = 90 \)。在 \( \alpha = 0.05 \) 时，上临界值为 \( F_{\alpha,9,90} = 1.9855 \)。由于 1.705910 低于临界值，原假设未被拒绝，没有足够证据声称各批次方差存在差异。<sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>

SciPy 的一个示例显示了相反的结果：对于三个样本 a、b 和 c，检验返回 p = 0.002431505967249681，样本方差分别为 0.00705、0.13074 和 0.00889。较小的 p 值表明总体方差不相等，这由样本 b 大得多的离散程度所驱动。<sup>[4](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levene.html)</sup>

## 扩展与应用

莱文型检验的应用已远超假设检查。统计文献综述的应用包括经济人类学、医学测量的准确性、石油价格波动性、法律案件中陪审团裁定额的一致性，以及飓风对生态系统的影响。<sup>[2](https://arxiv.org/abs/1010.0308)</sup>扩展工作将该检验推广到聚类数据——其中亚希内及其同事（Iachine et al.）变换观测值，并通过处理簇内依赖的回归框架检验变换后组均值的相等性——以及样本相关性和组成员资格不确定的情形。<sup>[19](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=957607)</sup><sup> • </sup><sup>[20](https://arxiv.org/abs/1605.05715)</sup>在基因组研究中，莱文检验和布朗-福赛斯检验是检测方差效应的标准工具，尽管二者都需要分类协变量，且均值形式还需要对称噪声，同时可容忍组样本量不等。<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC6330007/)</sup><sup> • </sup><sup>[1](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)</sup>

## References

1. [Levene Test for Equality of Variances, NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm)
2. [The Impact of Levene's Test of Equality of Variances on Statistical Theory and Practice, arXiv:1010.0308](https://arxiv.org/abs/1010.0308)
3. [Levene, H. 1960. Robust tests for the equality of variance. In Contributions to Probability and Statistics, pp. 278-292 (citation record)](https://www.srs.fs.usda.gov/pubs/ja/ja_cain015.pdf)
4. [scipy.stats.levene, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.levene.html)
5. [leveneTest: Levene's Test, car package documentation](https://rdrr.io/rforge/car/man/leveneTest.html)
6. [Why Psychologists Should by Default Use Welch's t-test Instead of Student's t-test, International Review of Social Psychology (2017)](https://rips-irsp.com/articles/10.5334/irsp.82)
7. [Zimmerman, D. W. (2004). A note on preliminary tests of equality of variances. British Journal of Mathematical and Statistical Psychology 57, 173-181](https://onlinelibrary.wiley.com/doi/pdf/10.1348/000711004849222)
8. [Tests for Homogeneity of Variance and Normality, University of Washington statistics course text](https://courses.washington.edu/psy524a/_book/tests-for-homogeneity-of-variance-and-normality.html)
9. [Subgroup Inconsistency and the Dilution Effect in Levene's Test for Homoscedasticity, arXiv:2609.17746](https://arxiv.org/abs/2609.17746)
10. [Brown, M. B. and Forsythe, A. B. (1974). Robust Tests for the Equality of Variances. Journal of the American Statistical Association 69, 364-367](https://www.tandfonline.com/doi/abs/10.1080/01621459.1974.10482955)
11. [Levene's Test of Variances, CTT tutorial](https://cttir.github.io/tutorials/tutorials/inference/levene-test.html)
12. [Making multiple comparisons easy: a decision tree and visual statistics guide, ImmunoHorizons](https://academic.oup.com/immunohorizons/article/10/1/vlaf072/8414379)
13. [Parametric Statistical Inference for Comparing Means and Variances, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC7425781/)
14. [Statistical tests for detecting variance effects in quantitative trait studies, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC6330007/)
15. [A comparison of tests of equality of variances, Computational Statistics & Data Analysis 22, 287-301 (1996)](https://www.sciencedirect.com/science/article/pii/0167947395000542)
16. [A Comparative Study of Tests for Homogeneity of Variances with Application to DNA Methylation Data, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC4684215/)
17. [A Comparison of Robust Tests for Homogeneity of Variance in Factorial ANOVA, Journal of Experimental Education 90(2)](https://www.tandfonline.com/doi/abs/10.1080/00220973.2020.1789833)
18. [Statistical tests for homogeneity of variance for clinical trials and recommendations, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC10151260/)
19. [Two tests of variance homogeneity for clustered data where group size is informative, NIST](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=957607)
20. [A Generalized Levene's Scale Test for Variance Heterogeneity in the Presence of Sample Correlation and Group Uncertainty, arXiv:1605.05715](https://arxiv.org/abs/1605.05715)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Hypothesis testing

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/levenes-test

English original: https://www.edgepedia.org/levenes-test
