Normality test: Anderson-Darling, Ryan-Joiner and KS explained

Updated

A normality test checks whether a column of data could plausibly come from a normal distribution. It pairs a normal probability plot, where normal data fall on a straight line, with a test statistic and a p-value. The null hypothesis is that the data are normal, so a small p-value (usually below 0.05) is evidence that they are not.

When to use it

  • Before a capability study with normal-based Cp and Cpk, which are very sensitive to the tails.
  • Before tests and intervals that assume normality and are sensitive to it, such as the 1-variance test, the F test for 2 variances, or tolerance intervals.
  • To decide whether to transform the data (for example with a Box-Cox transformation) or switch to a nonparametric method.
  • To check the residuals of an ANOVA or regression model.

How it works

The hypotheses are:

  • H₀: the data come from a normal distribution.
  • H₁: the data do not come from a normal distribution.

The mean and standard deviation are estimated from the data. Each test then measures, in its own way, how far the data are from the normal curve with those estimates.

Probability plot. Sort the data, x₍₁₎ ≤ … ≤ x₍ₙ₎. Give each value a plotting position, such as the median rank (i − 0.3)/(n + 0.4), and convert it to a normal score, the z value with that cumulative probability. Plot the data against the normal scores. If the data are normal, the points follow a straight line whose slope is the standard deviation. A curve that bends up at the right end means a long right tail; an S shape means tails that are too short or too long.

Anderson–Darling (A²). Compares the cumulative distribution of the data with the fitted normal one, with extra weight in the tails. With zᵢ = (x₍ᵢ₎ − x̄)/s and Φ the standard normal CDF:

A² = −n − (1/n) Σ (2i − 1) [ ln Φ(zᵢ) + ln(1 − Φ(zₙ₊₁₋ᵢ)) ]

The p-value uses the small-sample adjustment A*² = A²(1 + 0.75/n + 2.25/n²) and the approximation of D'Agostino and Stephens (1986). A larger A² means a worse fit.

Ryan–Joiner (RJ). The correlation between the sorted data and their normal scores bᵢ = Φ⁻¹((i − 0.375)/(n + 0.25)). Normal data give a correlation near 1. RJ is close to the Shapiro–Wilk test. Small values mean a poor fit; the critical value for n = 20 at α = 0.05 is 0.950.

Kolmogorov–Smirnov (KS). The largest vertical gap D between the empirical cumulative distribution and the fitted normal CDF. Because the mean and standard deviation are estimated, the p-value must come from Lilliefors' distribution, not the classic KS tables. KS is the least powerful of the three for typical engineering data.

Example

A chemical plant makes a pigment, and each batch is tested for trace iron, in ppm. The quality engineer wants to compute capability against an upper limit of 50 ppm, but first checks normality on the last 20 batches:

Iron (ppm)
8.110.832.617.84.5
12.08.313.14.613.9
13.830.914.516.34.9
46.43.823.29.87.1

The mean is 14.82 ppm, the median 12.55 ppm and the standard deviation 10.97 ppm. The mean sits well above the median, a first sign of a long right tail.

TestStatisticp-value
Anderson–DarlingA² = 1.124 (A*² = 1.172)0.0047, shown as <0.005
Ryan–JoinerRJ = 0.912below 0.01
Kolmogorov–SmirnovD = 0.212about 0.02 (Lilliefors)

The Ryan–Joiner and Lilliefors p-values here come from 200,000 simulated normal samples of size 20 (RJ 5% critical value 0.950; KS 5% critical value 0.192).

The probability plot shows the problem. The points sit on a curve, and the three highest batches lie far to the right of where a straight line through the middle would put them:

Normal probability plot of iron content-2-1012Normal score10203040Iron (ppm)
Normal probability plot of iron content

Trace impurities are often lognormal: their logarithms are normal. Taking the natural log of each value and testing again gives A² = 0.209 with p = 0.84, RJ = 0.989 and D = 0.098. The log data fit a normal distribution well, so the engineer can run the capability study on the log scale or use a lognormal fit.

How to read the results

  • p below 0.05: the data are unlikely to be normal. Look at the probability plot to see how they depart: one tail, both tails, a gap between two groups, or a few outliers.
  • p above 0.05: the test found no evidence against normality. That is not proof of normality, especially with fewer than about 20 values.
  • Trust the plot as much as the number. With hundreds of values, the tests flag departures too small to matter. With 10 values, they miss large ones. The plot shows whether the departure is in the part of the distribution you care about, such as the tail near a specification limit.
  • When the tests disagree, give more weight to Anderson–Darling or Ryan–Joiner. KS reacts mostly to the middle of the distribution and often misses tail problems.

Common mistakes

  • Testing mixed data. Two machines or two shifts in one column can produce a bimodal shape that fails the test, while each group alone is normal. Separate the groups first.
  • Testing rounded data. Values recorded in coarse steps pile up on a few numbers and can fail the test even when the process is normal. A chunky-data check spots this.
  • Removing "outliers" until the test passes. Investigate unusual values; do not delete them to get a high p-value.
  • Assuming every test needs normal data. The t-tests and ANOVA on means tolerate moderate non-normality with reasonable sample sizes. Tests and intervals for variances, tolerance intervals and capability indices do not.

Frequently asked questions

Which normality test is best?

For most engineering data, Anderson–Darling or Ryan–Joiner (similar to Shapiro–Wilk). Both are more powerful than Kolmogorov–Smirnov. Anderson–Darling is especially good at detecting tail problems, which matter most for capability and tolerance work.

What does a straight line on a probability plot mean?

That the data spread the way a normal distribution would. The line's center is the mean and its slope reflects the standard deviation. Points that curve away at one end show a skewed tail; a few points far off the line at the ends may be outliers.

My data fail the normality test. What now?

First look for a reason: mixed groups, rounding, outliers or a natural lower bound such as zero. If the process is naturally skewed, use a transformation (log or Box-Cox), fit a better distribution with individual distribution identification, or use a nonparametric method.

How many values do I need for a normality test?

At least 20 for a meaningful answer; 50 or more to detect moderate skewness reliably. Below 20, rely mostly on knowledge of the process and the plot.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab