Shapiro-Wilk Test#
The Shapiro-Wilk test is a statistical test for checking the normality assumption. It compares observed data against the expected values of a normal distribution and produces a W statistic between 0 and 1. The closer W is to 1, the better the data fit a normal distribution.
Developed in 1965 by Samuel Shapiro and Martin Wilk, the test is particularly powerful for sample sizes of n < 50 and is one of the most widely used normality tests. It is commonly applied as an assumption check before parametric procedures such as the t-test or ANOVA.
When to Use#
- Before running parametric tests (t-test, ANOVA) to verify the normality assumption
- With small to moderate sample sizes (n < 50), where the test has its greatest power
- To complement visual methods such as Q-Q plots or histograms
- When a formal statistical decision about the distributional form is required
- When analyzing residuals in regression models
Assumptions#
- Random sample from the population
- Continuous data at least at interval scale level
- Independent observations β no repeated measures or clusters
Formula#
The W statistic is computed as the ratio of two variance estimators:
Where:
- are the ordered sample values (order statistics)
- is the sample mean
- are tabulated weights derived from the expected values and covariance matrix of the order statistics of a normal distribution
where is the vector of expected order statistics and is the corresponding covariance matrix.
Hypotheses#
- Hβ: The data come from a normally distributed population
- Hβ: The data do not come from a normally distributed population
A significant result (p < Ξ±) leads to rejection of the normality assumption.
Example#
Practical Example: Blood Pressure Data Before a t-Test
A researcher wants to use a t-test to investigate whether a new medication lowers systolic blood pressure. She has measured the blood pressure of 30 patients. Before she can run the t-test, she needs to check whether the data are approximately normally distributed.
She performs the Shapiro-Wilk test and obtains W = 0.967 with p = 0.42. Since p > 0.05, the null hypothesis of normality cannot be rejected. The data are consistent with a normal distribution, and the t-test may be applied.
Additionally, she inspects the Q-Q plot, which also shows no systematic departures from normality.
Effect Size#
There is no traditional effect size measure for the Shapiro-Wilk test. The W statistic itself serves as a measure of departure from normality:
| W Value | Interpretation |
|---|---|
| 0.95 β 1.00 | Data are well consistent with normality |
| 0.90 β 0.95 | Mild departures from normality |
| < 0.90 | Substantial departures from normality |
Important: With large sample sizes (n > 100), the test becomes very sensitive and may flag even trivial departures as significant. In such cases, visual methods (Q-Q plot, histogram) should be used alongside the test.
Further Reading
- Shapiro, S. S., & Wilk, M. B. (1965). An analysis of variance test for normality (complete samples). Biometrika, 52(3-4), 591β611.
- Razali, N. M., & Wah, Y. B. (2011). Power comparisons of Shapiro-Wilk, Kolmogorov-Smirnov, Lilliefors and Anderson-Darling tests. Journal of Statistical Modeling and Analytics, 2(1), 21β33.
- Field, A. (2018). Discovering Statistics Using IBM SPSS Statistics (5th ed.). Sage Publications.