Normality test online: Jarque-Bera, Shapiro-Wilk, Kolmogorov
Normal or not? With 100 values drawn from a normal law, all three tests say “compatible” (Jarque-Bera p = 0.30, Shapiro-Wilk p = 0.24); a single point added 4.2 standard deviations from the mean is enough to reject normality. You learn to read a histogram and a Q-Q plot, then to compare three normality tests, a condition of the Student t test and the z test.
Course experiment; values are computed in the stated model and are not research results: the chapter and its slides (parts “Third and fourth moments” and “Normality test”) · all experiments · French version.
Try and interpret
The tested hypothesis is written at the top of the lab: H₀: the data follow a normal law. Choose a shape (normal, skewed, heavy tails, flat, two humps), set the departure from normality and the number of points n. The coloured banner gives the verdict in plain words: green if no test rejects H₀, red if all three reject it, orange if they disagree. The histogram takes the same colour and carries the normal curve with the same mean and standard deviation; the Q-Q plot shows where the points depart. Click on the histogram to add values, or place the extreme point and slide it: the bottom curve shows from where each test rejects normality.
Why test normality?
The z test, the Student t test and confidence intervals assume data (or means) following a normal law. As the course recalls, this assumption must be checked, at least a posteriori. The Jarque-Bera test, the course one, compares two features of the distribution with those of the normal law: its symmetry (S = 0) and its tail weight (C = 0). The lab compares it with two widely used tests: Shapiro-Wilk and Kolmogorov-Smirnov.
Definitions
- n, xᵢ
- The number of values and each value of the sample.
- x̄, s
- The sample mean and standard deviation (s computed with n − 1, as in the course).
- S (skewness)
- The mean of the cubed standardized deviations (xᵢ − x̄)/s. 0 for a symmetric distribution; S > 0: right tail; S < 0: left tail.
- C (excess kurtosis)
- The mean of the standardized deviations to the fourth power, minus 3. 0 for the normal law (“mesokurtic”); C > 0: heavier tails; C < 0: flatter distribution.
- JB
- The Jarque-Bera statistic, (n/6)(S² + C²/4): it grows with skewness, kurtosis and sample size.
- χ² with 2 df
- The limiting distribution of JB under normality. Its 5% cutoff is about 5.99; for small samples the reading is illustrative.
- H₀, p-value
- H₀: the data come from a normal law. p is the probability under H₀ of a statistic at least as large as the observed one. With the χ² approximation, p < 5% corresponds to JB above the asymptotic cutoff.
- W (Shapiro-Wilk)
- Measures how well the sorted values line up on the Q-Q line, between 0 and 1. W close to 1: data compatible with the normal law; small W: H₀ is rejected.
- D (Kolmogorov-Smirnov, Lilliefors version)
- The largest vertical gap between the cumulative distribution of the data and that of the normal law with the same x̄ and s. Large D: H₀ is rejected.
- Q-Q plot (normal quantile plot)
- Each sorted value is plotted against the normal quantile of the same rank. If the data are normal, the points follow the line x̄ + s·z.
Show the formulas
Where: n is the number of values xᵢ, x̄ their mean, s their standard deviation, S the skewness, C the excess kurtosis, JB the Jarque-Bera statistic and p the p-value.
Under H₀, JB approximately follows the χ² law with 2 degrees of freedom, whose survival function is simple: p = e−JB/2. With this asymptotic cutoff, a JB value below the cutoff means normality is not rejected.
Software (scipy, R) computes S and C with moments divided by n (standard deviation without the n − 1): values differ slightly for small samples and converge as n grows. The lab shows both.
Show the Shapiro-Wilk and Kolmogorov-Smirnov formulas
Where: x₍ᵢ₎ is the i-th smallest value, x̄ the mean, and the aᵢ are weights set by n, derived from the expected quantiles of the normal law (aᵢ < 0 for small values, aᵢ > 0 for large ones, Σaᵢ² = 1). W is the squared correlation between the sorted values and these weights: 1 when the points are perfectly aligned on the Q-Q line. The p-value uses Royston’s (1995) approximation, as in scipy and R.
Where: Fn(x) is the share of the n values less than or equal to x (empirical cumulative distribution), Φ the cumulative distribution of the standard normal law, x̄ and s the sample mean and standard deviation. Because x̄ and s are estimated from the same data, the classical Kolmogorov-Smirnov table would be too lenient: the Lilliefors table is used (Dallal and Wilkinson’s 1986 approximation, accurate for p < 0.10; above, the lab shows “p > 0.10”).
Assumptions and limits
The χ² law is only an approximation, valid for fairly large samples. With few data the test lacks power: not rejecting normality does not prove it. With many data, on the contrary, small harmless departures become significant. Always look at the histogram and the Q-Q plot besides the test.
Which test to choose?
- Shapiro-Wilk: the most powerful for small and medium samples (3 to 5,000 values); the default choice in statistical software.
- Jarque-Bera: easy to compute by hand (S and C), it targets asymmetry and tails; its p-value is asymptotic, so it is reliable mostly for large samples.
- Kolmogorov-Smirnov (Lilliefors): it compares cumulative distributions; it reacts mostly to the centre of the distribution and little to the tails: the least powerful of the three.
Lab samples are drawn at random (reproducible generator) from laws chosen for the example; “New draw” changes the sample.
Exercises
The first two are hand calculations from the course (slide “Third and fourth moments”), no exam paper.
- Hand calculation (course exercise). x = 2, 6, 8, 8, 9, 9, 10, 11, 11, 12, 12, 14, 18; given x̄ = 10.0 and s = 3.873. Compute S and C.
Show the answer
The deviations from the mean are symmetric: S = 0. Σ((x − x̄)/s)⁴/13 = 2.999 so C = −0.001 ≈ 0: a mesokurtic, symmetric set. JB ≈ 0, p ≈ 1: nothing allows rejecting normality (n = 13 remains small).
- Second course calculation. x = 7, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 13, 18; x̄ = 10.5 and s = 2.989. Compute S, C, then JB.
Show the answer
S = +0.72 (right tail, mostly due to the 18) and C = −0.0005 ≈ 0. JB = 16/6 × (0.72² + 0) = 1.40 < 5.99, p = 0.50: normality is not rejected.
- Is one point enough? Start from the “Normal” sample of 100 values and add the extreme point. From how many standard deviations away from the mean is normality rejected?
Show the answer
Read the bottom curve: Jarque-Bera and Shapiro-Wilk become significant from 4.2 standard deviations, above or below the mean (at 4.0: JB = 3.6, p = 0.17; Shapiro-Wilk p = 0.060). Kolmogorov-Smirnov barely reacts: one isolated point hardly changes the largest gap D between the two cumulative distributions.
- The effect of n. Choose “Skewed”, set the departure from normality to 0.3 and raise n from 30 to 300. What happens to JB and to the verdict?
Show the answer
With 30 points, JB = 1.4 (p = 0.50): none of the three tests rejects H₀, the skewness goes unnoticed. With 300 points drawn from the same law, JB = 40 (p < 0.0001) and all three tests reject H₀. JB is proportional to n: with many data, a small departure from normality becomes detectable; with few data, not rejecting does not prove normality.
- Do the tests agree? Load the “Flat (uniform)” example (100 points), then “Heavy tails”. Which tests reject normality?
Show the answer
Flat distribution: Shapiro-Wilk rejects H₀ (p = 0.012), but neither Jarque-Bera (p = 0.092) nor Kolmogorov-Smirnov (p = 0.060): orange banner, a borderline case. Heavy tails: only Jarque-Bera rejects (p = 0.044; Shapiro-Wilk p = 0.15). Each test looks at a different feature of the shape: always look at the histogram and the Q-Q plot before concluding.
Going further
- The full course chapter: the normal law, moments and tests on means
- The normal distribution: area, probability and z-score
- The z test and the Student t test, which assume normality
- The χ² test: the same law, for counts
Cite this page
Cyril Voyant (2026). Normality test online: Jarque-Bera, Shapiro-Wilk, Kolmogorov. https://www.cyrilvoyant.com/tools/jarque-bera-test/. CC BY 4.0.
BibTeX entry, cited in a LaTeX document with \cite{voyant2026_jarqueberatest} (package url or hyperref):
@misc{voyant2026_jarqueberatest,
author = {Voyant, Cyril},
title = {{Normality test online: Jarque-Bera, Shapiro-Wilk, Kolmogorov}},
year = {2026},
howpublished = {\url{https://www.cyrilvoyant.com/tools/jarque-bera-test/}},
note = {Interactive biostatistics tool, PASS UE8 course, Mines Paris -- PSL. CC BY 4.0 licence},
language = {english}
}Course archive (all versions) · Biostatistics course (10.5281/zenodo.23620235).