# Shapiro–Wilk test

The Shapiro–Wilk test is a statistical test of the null hypothesis that a sample of data was drawn from a normal distribution, proposed by Samuel S. Shapiro and Martin B. Wilk in 1965 in *Biometrika* under the title "An Analysis of Variance Test for Normality (Complete Samples)"<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>. It computes a statistic W from the ordered sample values and rejects normality when W is small<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>.

| Key fact | Detail |
|---|---|
| Origin | Proposed by S. S. Shapiro and M. B. Wilk, *Biometrika*, Vol. 52, No. 3/4 (Dec. 1965), pp. 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> |
| Null hypothesis | The data were drawn from a normal distribution; small values of W are evidence of departure from normality<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>  |
| Statistic | \( W = \frac{\left( \sum_{i=1}^n a_i x_{(i)} \right)^2}{\sum_{i=1}^n (x_i - \bar{x})^2} \), with \( x_{(i)} \) the ordered sample values and \( a_i \) constants derived from normal order statistics<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup> |
| Range | Scale and origin invariant; maximum value 1, with a minimum of approximately the square of the smallest coefficient for \( n > 10 \)<sup>[4](https://www.statsref.com/HTML/shapiro-wilk.html)</sup> |
| Power | Simulation studies repeatedly find good power, particularly against asymmetric alternatives and in small samples<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>  |

## The W statistic

The test compares the ordered sample values \( x_{(1)} \le x_{(2)} \le \cdots \le x_{(n)} \) against the values expected under normality. The statistic is

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

Here the coefficients \( a_i \) are derived from the means, variances, and covariances that the order statistics of a normally distributed sample of size \( n \) possess<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>. The numerator is essentially a weighted sum of the ordered data, with weights that give the largest influence to the extreme order statistics, and the denominator is the usual sum of squared deviations from the sample mean<sup>[6](https://math.mit.edu/~rmd/465/shapiro.pdf)</sup>.

The coefficients are computed from the expected values \( M \) of standard normal order statistics and their covariance matrix \( V \), through \( 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 has a geometric interpretation: it may be thought of as the squared correlation coefficient between the ordered sample values and the coefficients \( w_i \), which are approximately proportional to the normal scores. It is therefore a measure of the straightness of the normal probability plot, and small values indicate departures from normality<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)</sup>. The statistic is invariant to changes of scale and location, and its maximum value is 1<sup>[4](https://www.statsref.com/HTML/shapiro-wilk.html)</sup>.

Percentage points for W, obtained by [Monte Carlo](https://www.edgepedia.org/monte-carlo) simulation, were tabulated in Pearson and Hartley (1972, Table 16); in current practice the test is almost always applied through statistical software that produces the critical values or a p-value directly<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>.

## Origin and extensions

Shapiro and Wilk designed W as an index for evaluating the supposed normality of a complete sample, and their 1965 paper reported that it was an effective measure of normality even for small samples (\( n < 20 \)) against a wide spectrum of non-normal alternatives<sup>[1](https://webspace.ship.edu/pgmarr/geo441/readings/shapiro%20and%20wilk%201965%20-%20an%20analysis%20of%20variance%20test%20for%20normality.pdf)</sup>.

The original formulation relied on tables of coefficients and critical values, which limited the usable sample sizes. Patrick Royston extended the W test to large samples in 1982, and his later algorithm for complete and censored samples, published in 1993, is the one implemented in SciPy's `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 uses the related AS R94 (SWILK) algorithm from *Applied Statistics* (1995, Vol. 44, No. 4), which produces accurate critical values for \( N \le 5000 \)<sup>[7](https://itl.nist.gov/div898/software/dataplot/refman1/auxillar/wilkshap.htm)</sup>.

A related but distinct procedure, the Shapiro–Francia test, simplifies the construction and is often grouped with Shapiro–Wilk in power comparisons<sup>[8](https://www.hrpub.org/journals/article_info.php?aid=11572)</sup>.

## Power in comparison studies

The test's reputation rests on a long series of Monte Carlo power studies, in which simulated data from non-normal distributions are tested to see how often each procedure detects the departure. The NIST handbook states that the test "has done very well in comparison studies with other goodness of fit tests"<sup>[3](https://www.itl.nist.gov/div898/handbook/prc/section2/prc213.htm)</sup>.

Several findings recur across these studies:

- A 2022 simulation of twelve [normality tests](https://www.edgepedia.org/normality-test) found that for asymmetric distributions the Shapiro–Wilk and Ryan–Joiner tests perform fairly well for all sample sizes studied, and that the popular software tests, including Shapiro–Wilk, Ryan–Joiner, and Anderson–Darling, work at least moderately well for most cases considered<sup>[5](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)</sup>.
- In a simulation study comparing the power and sensitivity of sixteen normality tests across various non-normal scenarios, the correlation- and regression-based procedures, including Shapiro–Wilk and Shapiro–Francia, proved more powerful than the rest, particularly when samples were large and departures from normality were considerable.<sup>[9](https://doi.org/10.22430/22565337.3293)</sup>
- The Razali and Wah comparison of Shapiro–Wilk, Kolmogorov–Smirnov, Lilliefors, and Anderson–Darling tests, with critical values obtained for sample sizes from \( n = 10 \) to \( n = 2000 \), is frequently cited in support of Shapiro–Wilk's power over a wide range of asymmetric distributions<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>.

No single test dominates every alternative. For the exponential distribution, a 2008 simulation study found the Tiku statistic based on sample spacings and a modified Anderson–Darling statistic to be the most powerful, and it proposed a combined omnibus statistic C, built from the Shapiro–Wilk W and the correlation statistic R, whose null distribution can be approximated by a four-moment F distribution and which was overall more powerful than other prominent tests against both symmetric and skew alternatives<sup>[12](https://www.sciencedirect.com/science/article/pii/S0898122108001880)</sup>. Under heavy-tailed and contaminated normal residuals, the [Anderson–Darling test](https://www.edgepedia.org/anderson-darling-test) performed best in one comparison of tests for regression residuals<sup>[13](https://journalajpas.com/index.php/AJPAS/article/view/935)</sup>.

## Practical use and limitations

The test requires complete samples and a minimum of three observations in SciPy's implementation<sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>. Because the coefficients \( a_i \) depend on the sample size, software implementations cap the size they handle; beyond about 5,000 observations the W statistic remains accurate but the computed p-value may not<sup>[2](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.shapiro.html)</sup>.

Interpretation also depends on sample size in a subtler way. With large samples, trivial departures from normality become statistically significant, so a rejection says little about whether the departure matters for a subsequent analysis; with small samples, the test has limited power to detect real departures. A 2022 simulation-based recommendation is therefore a two-tier approach: first observe the shape of the empirical data distribution using graphical methods, then select an appropriate test based on the likely distributional shape and the corresponding sample size<sup>[5](https://www.tandfonline.com/doi/abs/10.1080/03610918.2019.1658780)</sup>. In a regression workflow simulation with sample sizes of 10, 20, and 50, switching to a Mann–Whitney test when model residuals failed a normality test produced a modest power improvement of 3 to 4 percent, one of the few scenarios in that study where the normality test changed the analysis outcome<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC12040466/)</sup>.

The test is also specific: it tests exact normality, not approximate normality, and it can be sensitive in settings such as data that have been power-transformed by a Box–Cox procedure, where one study reported severe bias in the Shapiro–Wilk statistic applied to transformed data<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: Physical world and mathematics › Mathematics and statistics › Statistics and probability › 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/shapiro-wilk-test
