PickMyTest

Shapiro-Wilk Test

The Shapiro-Wilk test assesses whether a sample comes from a normally distributed population. It is considered one of the most powerful normality tests for small to moderate sample sizes.

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:

W=(βˆ‘i=1nai x(i))2βˆ‘i=1n(xiβˆ’xΛ‰)2W = \frac{\left(\sum_{i=1}^{n} a_i \, x_{(i)}\right)^2}{\sum_{i=1}^{n} (x_i - \bar{x})^2}

Where:

  • x(i)x_{(i)} are the ordered sample values (order statistics)
  • xΛ‰\bar{x} is the sample mean
  • aia_i are tabulated weights derived from the expected values and covariance matrix of the order statistics of a normal distribution
(a1,a2,…,an)=mTVβˆ’1(mTVβˆ’1Vβˆ’1m)1/2(a_1, a_2, \ldots, a_n) = \frac{m^T V^{-1}}{(m^T V^{-1} V^{-1} m)^{1/2}}

where mm is the vector of expected order statistics and VV 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 ValueInterpretation
0.95 – 1.00Data are well consistent with normality
0.90 – 0.95Mild departures from normality
< 0.90Substantial 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.