# 夏皮罗–威尔克检验

夏皮罗–威尔克检验是一种统计检验，其零假设为：样本数据取自正态分布。该检验由塞缪尔·S·夏皮罗（Samuel S. Shapiro）与马丁·B·威尔克（Martin B. Wilk）于1965年在《生物计量学》（*Biometrika*）上提出，论文题为《正态性的方差分析检验（完整样本）》<sup>[1](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)</sup><sup> • </sup><sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>。该检验根据有序样本值计算统计量 W，当 W 较小时拒绝正态性<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>。

| 关键事实 | 详情 |
|---|---|
| 起源 | 由 S. S. 夏皮罗与 M. B. 威尔克提出，《生物计量学》，第52卷，第3/4期（1965年12月），第591–611页<sup>[1](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)</sup> |
| 零假设 | 数据取自正态分布；W 值较小即为偏离正态性的证据<sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup><sup> • </sup><sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>  |
| 统计量 | \( W = \frac{\left( \sum_{i=1}^n a_i x_{(i)} \right)^2}{\sum_{i=1}^n (x_i - \bar{x})^2} \)，其中 \( x_{(i)} \) 为有序样本值，\( a_i \) 为由正态次序统计量导出的常数<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup> |
| 取值范围 | 对尺度和原点不变；最大值为1，当 \( n > 10 \) 时最小值约为最小系数的平方<sup>[4](https://www.statsref.com/HTML/shapiro-wilk.html)</sup> |
| 效能 | 模拟研究反复发现其效能良好，尤其是针对非对称备择分布和小样本情形<sup>[5](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)</sup><sup> • </sup><sup>[1](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)</sup>  |

## W 统计量

该检验将有序样本值 \( x_{(1)} \le x_{(2)} \le \cdots \le x_{(n)} \) 与正态性下所期望的值进行比较。统计量为

\[ W = \frac{\left( \sum_{i=1}^n a_i x_{(i)} \right)^2}{\sum_{i=1}^n (x_i - \bar{x})^2}, \]

其中系数 \( a_i \) 由大小为 \( n \) 的正态分布样本的次序统计量所具有的均值、方差和协方差导出<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>。分子本质上是有序数据的加权和，其权重赋予极端次序统计量最大的影响，而分母则是通常的样本均值离差平方和<sup>[6](https://math.mit.edu/~rmd/465/shapiro.pdf)</sup>。

系数由标准正态次序统计量的期望值 \( M \) 及其协方差矩阵 \( V \) 通过 \( w' = MV^{-1}[(M'V^{-1})(V^{-1}M)]^{-1/2} \) 计算得出<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)</sup>。

W 具有几何解释：它可以被视为有序样本值与系数 \( w_i \) 之间的平方相关系数，而 \( w_i \) 近似正比于正态得分。因此，它是正态概率图直线性的一种度量，较小的值表明偏离正态性<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)</sup>。该统计量对尺度和位置的变化不变，其最大值为1<sup>[4](https://www.statsref.com/HTML/shapiro-wilk.html)</sup>。

W 的百分位点通过蒙特卡洛模拟获得，已在皮尔逊与哈特利（Pearson and Hartley，1972，表16）中制表；在当前实践中，该检验几乎总是通过统计软件来应用，软件直接给出临界值或 p 值<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>。

## 起源与扩展

夏皮罗与威尔克将 W 设计为评估完整样本假定正态性的指标，他们1965年的论文报告称，即使对于小样本（\( n < 20 \)），面对广泛的非正态备择分布，它也是正态性的有效度量<sup>[1](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)</sup>。

最初的公式依赖于系数表和临界值表，这限制了可用的样本量。帕特里克·罗伊斯顿（Patrick Royston）于1982年将 W 检验扩展到大样本，他后来于1993年发表的针对完整样本和删失样本的算法，正是 SciPy 中 `scipy.stats.shapiro` 所实现的算法<sup>[4](https://www.statsref.com/HTML/shapiro-wilk.html)</sup><sup> • </sup><sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>。Dataplot 使用来自《应用统计学》（*Applied Statistics*，1995，第44卷，第4期）的相关 AS R94（SWILK）算法，该算法可为 \( N \le 5000 \) 产生精确的临界值<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)</sup>。

一个相关但不同的程序——夏皮罗–弗朗西亚检验（Shapiro–Francia test）——简化了构造，在效能比较中常与夏皮罗–威尔克检验归为一组<sup>[8](https://www.hrpub.org/journals/article_info.php?aid=11572)</sup>。

## 比较研究中的效能

该检验的声誉建立在一系列长期的蒙特卡洛效能研究之上，这些研究用来自非正态分布的模拟数据进行检验，以观察每种程序检测到偏离的频率。NIST 手册指出，该检验“在与其他拟合优度检验的比较研究中表现非常好”<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>。

这些研究中反复出现若干发现：

- 2022年一项对十二种正态性检验的模拟发现，对于非对称分布，夏皮罗–威尔克检验和瑞安–乔伊纳检验（Ryan–Joiner test）在所研究的所有样本量下表现都相当好，而流行的软件检验——包括夏皮罗–威尔克、瑞安–乔伊纳和安德森–达林检验（Anderson–Darling test）——在所考虑的大多数情形下至少表现中等良好<sup>[5](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)</sup>。
- 在一项比较十六种正态性检验在各种非正态情景下的效能与敏感性的模拟研究中，基于相关和回归的程序——包括夏皮罗–威尔克和夏皮罗–弗朗西亚检验——被证明比其他程序更有力，尤其是当样本量大且偏离正态性程度显著时。<sup>[9](https://doi.org/10.22430/22565337.3293)</sup>
- 拉扎利与瓦赫（Razali and Wah）对夏皮罗–威尔克、柯尔莫哥洛夫–斯米尔诺夫、利利福斯和安德森–达林检验的比较（临界值针对从 \( n = 10 \) 到 \( n = 2000 \) 的样本量获得），常被引用来支持夏皮罗–威尔克在广泛的非对称分布上的效能<sup>[10](https://www.nbi.dk/~petersen/Teaching/Stat2020/Power_Comparisons_of_Shapiro-Wilk_Kolmogorov-Smirn.pdf)</sup><sup> • </sup><sup>[11](https://www.researchgate.net/profile/Robert-Tomsik/publication/333133367_Power_Comparisons_of_Shapiro-Wilk_Kolmogorov-Smirnov_and_Jarque-Bera_Tests/links/5ed2243745851529451be26d/Power-Comparisons-of-Shapiro-Wilk-Kolmogorov-Smirnov-and-Jarque-Bera-Tests.pdf)</sup>。

没有哪一种检验在所有备择分布下都优于其他检验。对于指数分布，2008年的一项模拟研究发现，基于样本间距的蒂库统计量和一种改进的安德森–达林统计量最为有力，并提出了一种组合综合统计量 C，它由夏皮罗–威尔克 W 和相关系数统计量 R 构成，其零分布可用基于前四阶矩拟合的 F 分布近似，且在对对称和偏斜备择分布的整体效能上均优于其他著名检验<sup>[12](https://www.sciencedirect.com/science/article/pii/S0898122108001880)</sup>。在重尾和受污染的正态残差下，安德森–达林检验在一项回归残差检验比较中表现最佳<sup>[13](https://journalajpas.com/index.php/AJPAS/article/view/935)</sup>。

## 实际使用与局限

该检验要求完整样本，在 SciPy 的实现中至少需要三个观测值<sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>。由于系数 \( a_i \) 依赖于样本量，软件实现会限制其处理的样本量；超过约5000个观测值时，W 统计量仍然准确，但计算出的 p 值可能不准确<sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>。

解释还以更微妙的方式依赖于样本量。对于大样本，微不足道的偏离正态性也会变得统计显著，因此，拒绝正态性假设并不能充分说明这种偏离对后续分析是否重要；对于小样本，该检验检测真实偏离的效能有限。因此，2022年一项基于模拟的建议是采用两层方法：首先用图形方法观察经验数据分布的形状，然后根据可能的分布形状和相应的样本量选择合适的检验<sup>[5](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)</sup>。在一项样本量为10、20和50的回归工作流模拟中，当模型残差未通过正态性检验时改用曼–惠特尼检验（Mann–Whitney test），效能仅提高了3%到4%，这是该研究中少数正态性检验改变了分析结果的场景之一<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC12040466/)</sup>。

该检验还具有特异性：它检验的是精确正态性，而非近似正态性，并且在某些情形下可能敏感，例如经 Box–Cox 变换处理的数据——一项研究报道，夏皮罗–威尔克统计量应用于变换后的数据时存在严重偏差<sup>[15](https://arxiv.org/abs/2407.19329)</sup>。

## References

1. [S. S. Shapiro and M. B. Wilk (1965). An Analysis of Variance Test for Normality (Complete Samples). *Biometrika* 52(3/4), 591–611.](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)
2. [scipy.stats.shapiro, SciPy v1.18.0 Manual](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)
3. [NIST/SEMATECH e-Handbook of Statistical Methods, Section 7.2.1.3: Anderson–Darling and Shapiro–Wilk tests](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)
4. [StatsRef: Shapiro–Wilk](https://www.statsref.com/HTML/shapiro-wilk.html)
5. [Power analysis of several normality tests: A Monte Carlo simulation study, *Communications in Statistics – Simulation and Computation* 51(3)](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)
6. [The Shapiro–Wilk and related tests for normality (MIT lecture notes)](https://math.mit.edu/~rmd/465/shapiro.pdf)
7. [NIST Dataplot Reference Manual: Wilk–Shapiro Normal Test](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)
8. [Power Comparisons of Normality Tests Based on L-moments and Classical Tests, *Mathematics and Statistics*](https://www.hrpub.org/journals/article_info.php?aid=11572)
9. [Simulation Study on the Power and Sensitivity of Sixteen Normality Tests Under Different Non-Normality Scenarios, *TecnoLógicas*](https://doi.org/10.22430/22565337.3293)
10. [N. M. Razali and Y. B. Wah (2011). Power comparisons of Shapiro–Wilk, Kolmogorov–Smirnov, Lilliefors and Anderson–Darling tests](https://www.nbi.dk/~petersen/Teaching/Stat2020/Power_Comparisons_of_Shapiro-Wilk_Kolmogorov-Smirn.pdf)
11. [Power Comparisons of Shapiro–Wilk, Kolmogorov–Smirnov and Jarque–Bera Tests (Table 2)](https://www.researchgate.net/profile/Robert-Tomsik/publication/333133367_Power_Comparisons_of_Shapiro-Wilk_Kolmogorov-Smirnov_and_Jarque-Bera_Tests/links/5ed2243745851529451be26d/Power-Comparisons-of-Shapiro-Wilk-Kolmogorov-Smirnov-and-Jarque-Bera-Tests.pdf)
12. [A power comparison and simulation study of goodness-of-fit tests, *Computers & Mathematics with Applications* 56(6), 1617–1625 (2008)](https://www.sciencedirect.com/science/article/pii/S0898122108001880)
13. [Power Comparison of Selected Robust Non Parametric Tests for Assessing the Normality of Regression Residuals, *Asian Journal of Probability and Statistics*](https://journalajpas.com/index.php/AJPAS/article/view/935)
14. [Testing for normality in regression models: mistakes abound (but may not matter), PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC12040466/)
15. [Testing Normality of Data Transformed by Maximum Likelihood Box Cox, arXiv](https://arxiv.org/abs/2407.19329)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 20, 2026; Oct 15, 2026 · Edited: 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/shapiro-wilk-test

English original: https://www.edgepedia.org/shapiro-wilk-test
