Q-Q plots and normal distribution both mention the Shapiro-Wilk test as the standard formal companion to a visual normality check, without showing how the test statistic is actually computed. The Shapiro-Wilk test produces a single number, W, that quantifies how closely a sample's shape matches what a normal distribution would predict — the numeric counterpart to the Q-Q plot's visual impression, and the test most commonly recommended specifically because of its strong statistical power relative to other normality tests.
- The W statistic's formula, and what it measures
- A full worked example, computed by hand on the same dataset used to build a Q-Q plot
- How to read the result — and why it agrees with that Q-Q plot's visual impression
- The test's real limitation: sensitivity to sample size
The Formula
The denominator is simply the sum of squared deviations from the mean — the same quantity used to compute variance. The numerator is a weighted combination of the sorted data values, using coefficients (aᵢ) that come from published statistical tables specific to the sample size n — not something calculated from the data itself, similar to how a t-test or chi-square test looks up a critical value from a table rather than deriving it fresh each time. W ranges from 0 to 1, with values close to 1 indicating the data closely resembles a normal distribution.
Worked Example
Problem: Using the same 6 exam scores from the Q-Q plot worked example — 62, 68, 71, 75, 78, 95 — compute the Shapiro-Wilk W statistic by hand.
Sorted data: 62, 68, 71, 75, 78, 95. The mean is 74.83, and the sum of squared deviations from the mean is 642.83 — this is the denominator.
For n=6, published Shapiro-Wilk coefficients are a₆=0.6431, a₅=0.2806, a₄=0.0875 (with a₁=−a₆, a₂=−a₅, a₃=−a₄ by symmetry). The numerator combines the data in symmetric pairs — smallest with largest, second-smallest with second-largest, and so on:
b = 0.6431×(95−62) + 0.2806×(78−68) + 0.0875×(75−71) = 0.6431×33 + 0.2806×10 + 0.0875×4 ≈ 24.38
W = b² / 642.83 = 24.38² / 642.83 = 594.4 / 642.83 ≈ 0.9245
With n=6, this W value corresponds to a p-value of approximately 0.538 — well above the conventional 0.05 threshold, so the test fails to reject the null hypothesis of normality. Despite the visibly high value of 95 in the Q-Q plot pulling one point off the diagonal line, the formal test doesn't flag this small sample as significantly non-normal.
The same conclusion is visible without a p-value at all: the Shapiro-Wilk critical values table gives roughly 0.79 as the critical W for n=6 at α=0.05, and the computed W=0.9245 clears it comfortably.
Why the Test Doesn't Flag the Outlier
This result is genuinely worth sitting with, since it might seem to contradict the Q-Q plot's visual impression. With only 6 observations, the Shapiro-Wilk test has very limited statistical power — the ability to detect a real departure from normality when one exists. A single somewhat-high value in a sample this small simply isn't enough evidence, on its own, to statistically distinguish "genuinely non-normal" from "a normal distribution that happened to produce one higher value by chance." This is exactly why a Q-Q plot and a formal test are meant to be used together, not as competing verdicts: the Q-Q plot shows a pattern worth noting even when the formal test can't yet confirm it statistically, and the formal test provides the quantified caution that a visual impression alone can overstate, especially with a small sample.
Interpreting the Result
A small p-value (below the chosen α, typically 0.05) leads to rejecting the null hypothesis of normality — the data shows a statistically significant departure from a normal distribution. A large p-value, as in the worked example above, means there isn't sufficient evidence to conclude the data is non-normal — importantly, this is not the same as proving the data is normal, a distinction that runs through every hypothesis test on this site: failing to reject a null hypothesis is never the same as confirming it's true.
The Test's Real Limitation: Sample Size Sensitivity
The Shapiro-Wilk test's power scales directly with sample size, in both directions that matter. With a small sample (as in the worked example), even a real, meaningful departure from normality can go undetected. With a very large sample, the test can flag statistically significant — but practically trivial — departures from perfect normality, since real data almost never follows a distribution exactly, and a large enough sample gives the test the power to detect even tiny, inconsequential deviations. This is why the test's p-value should be interpreted alongside a visual check (the Q-Q plot, or a histogram) rather than treated as a standalone, automatic pass/fail gate.
Real-World Uses
Validating assumptions before a parametric test: as covered in exploratory data analysis, checking normality before running a t-test, ANOVA, or linear regression is standard practice — the Shapiro-Wilk test is the most commonly recommended formal check for this purpose across many fields.
Quality control and process validation: manufacturing processes are often assumed to produce output with normally distributed measurements around a target value — the Shapiro-Wilk test is a standard tool for confirming that assumption before applying control-chart methods or other normality-dependent quality techniques.
Financial and scientific data screening: researchers routinely run a formal normality test as a first-pass screening step on a new dataset, flagging series that may need a transformation (like a log transform) or a non-parametric method before further analysis proceeds.
Common Mistakes
Treating a non-significant result as proof of normality. As explained above, failing to reject the null hypothesis only means the data doesn't provide strong enough evidence against normality — it's a genuinely different claim from confirming normality holds.
Ignoring sample size when interpreting the result. A p-value from a test on 6 observations and a p-value from a test on 6,000 observations carry very different statistical power behind them — always consider sample size alongside the raw p-value, not just the p-value in isolation.
Is the Shapiro-Wilk test the only normality test available?
Why can't the coefficients be derived by hand instead of looked up?
Does the Shapiro-Wilk test work for very small samples, like n=3 or n=4?
Should the Shapiro-Wilk test always be run before a t-test or ANOVA?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals →