Goodness of Fit

Shapiro-Wilk Test

The Shapiro-Wilk Test evaluates whether a sample comes from a normally distributed population. Use it to check the normality assumption before running parametric tests like t-tests or ANOVA.

Share
Shapiro-Wilk Test

Quick Hits

  • Tests whether a sample comes from a normal distribution
  • Most powerful normality test for small to moderate samples (n < 5000)
  • Null hypothesis: the data IS normally distributed (rejecting means non-normal)
  • W statistic close to 1 indicates normality; close to 0 indicates departure
  • With large samples, even trivial deviations from normality will be flagged as significant

The StatsTest Flow: Difference or Goodness of Fit >> Testing Distribution Assumptions >> Is my data normally distributed?

Not sure this is the right statistical method? Use the Choose Your StatsTest workflow to select the right method.


What is the Shapiro-Wilk Test?

The Shapiro-Wilk Test is a statistical test that evaluates whether a sample of data comes from a normally distributed population. It is the most powerful test for normality for samples from 3 to approximately 5,000 observations.

The test produces a W statistic between 0 and 1. Values close to 1 indicate the data is consistent with a normal distribution; values significantly below 1 indicate departure from normality. The accompanying p-value tells you whether the departure is statistically significant.

The Shapiro-Wilk Test is also called the Shapiro-Wilk Normality Test or the W Test.


Assumptions for the Shapiro-Wilk Test

The assumptions for the Shapiro-Wilk Test include:

  1. Continuous Data
  2. Independent Observations
  3. Sample Size Between 3 and ~5,000

Continuous Data

The data should be continuous or at least measured on a scale fine enough to assess distributional shape. The test is not appropriate for categorical or ordinal data.

Independent Observations

Each data point should be independent. If observations are clustered or time-dependent, the test results may be misleading.

Sample Size

The Shapiro-Wilk test works best with sample sizes from 3 to about 5,000. For very large samples, the test becomes overly sensitive and will reject normality for trivially small deviations that have no practical impact on downstream analyses.


When to use the Shapiro-Wilk Test?

  1. You want to check if your data is normally distributed before running a parametric test
  2. Your sample size is small to moderate (n < 5,000)
  3. You need a formal statistical test of normality (rather than just visual inspection)

For comparing your data to distributions other than normal, use the Kolmogorov-Smirnov Test. For testing equal variances between groups, use Levene's Test.


Shapiro-Wilk Test Example

You plan to compare test scores between two teaching methods using an Independent Samples T-Test. Before running the t-test, you check whether the scores in each group are normally distributed.

Group 1 (Method A): W = 0.967, p = 0.42 -> No evidence against normality. Group 2 (Method B): W = 0.981, p = 0.71 -> No evidence against normality.

Since both groups pass the Shapiro-Wilk test (p > 0.05), the normality assumption for the t-test is satisfied. You proceed with the parametric test. If either group had a significant Shapiro-Wilk result with a clearly non-normal QQ plot, you would consider the Mann-Whitney U Test instead.


References

  1. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3693611/
  2. https://real-statistics.com/tests-normality-and-symmetry/statistical-tests-normality-symmetry/shapiro-wilk-test/

Frequently Asked Questions

My Shapiro-Wilk p-value is less than 0.05. Does that mean I can't use a t-test?
Not necessarily. The t-test is robust to moderate departures from normality, especially with larger samples (n > 30). A significant Shapiro-Wilk test tells you the data is not perfectly normal, but visual checks (QQ plot, histogram) are more informative about whether the departure is severe enough to matter. Consider non-parametric alternatives only if the departure is substantial.
Should I always run a normality test before a t-test?
This is debated. Many statisticians recommend visual assessment (QQ plots) over formal normality tests because formal tests are overpowered with large samples and underpowered with small ones. A practical approach: with n > 30, parametric tests are usually fine regardless. With small samples, check the QQ plot and consider a non-parametric alternative if the departure is severe.
What is the difference between Shapiro-Wilk and Kolmogorov-Smirnov?
Shapiro-Wilk is specifically designed to test normality and is more powerful for that purpose. Kolmogorov-Smirnov tests whether data follows ANY specified distribution (not just normal) and is less powerful for normality testing. Use Shapiro-Wilk for normality; use Kolmogorov-Smirnov for other distributions or for comparing two samples.

Key Takeaway

The Shapiro-Wilk test is the most widely used and most powerful formal test of normality for small to moderate samples. However, use it as one tool among several: QQ plots and histograms often provide more practical information about whether non-normality is severe enough to affect your analysis.

Send to a friend

Share this with someone who loves clean statistical work.