Skip to content

ADescribe · Guide test 110

Cramér–von Mises normality test

Tests normality using an integrated squared discrepancy from a fitted normal distribution.

Runs in CodeSplashPython (calls R) example not runR example validated

Do it in CodeSplash

In the app, set it up in Analyze with one of these methods:

In Normality test (one test), choose Test = Cramér–von Mises.

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Cramér–von Mises normality test

40
0.60

Sinh–arcsinh shape: 0 is symmetric.

1.00

Below 1: heavier tails than normal; 1 with ε = 0 is exactly normal.

0.050

Your data

Drag a point or use ↑/↓ to change it
Sample · n = 40 · mean 1.12

If H₀ were true

W² = 0.15
  1. The reference: how W² varies across samples when H₀ is true, Stephens' approximation for estimated mean and SD (Stephens' formula for p).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .025).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

W2=112n+∑i(Φ(z(i))−2i−12n)2,z=x−xˉsW^2=\dfrac{1}{12n}+\sum_i\left(\Phi(z_{(i)})-\dfrac{2i-1}{2n}\right)^2,\quad z=\dfrac{x-\bar x}{s}

With your numbers

W2=0.15,(1+0.5n)W2=0.15W^2 = 0.15,\qquad (1+\tfrac{0.5}{n})W^2 = 0.15
Φ(z(i))\Phi(z_{(i)})
normal CDF at the standardized order statistics
(1+0.5/n)(1+0.5/n)
Stephens' small-sample modification

The verdict

W² = 0.15, p = .025

p ≤ α = .050: reject H₀

Squared ECDF distance averaged over the whole range, so it weighs the center more than Anderson–Darling. The p uses Stephens' formulas for estimated parameters.

Statistic
0.146
p-value
0.0255
Cramér–von Mises normality test on Sample: n = 40: W² = 0.15, p = .025. The p-value is below α = .050, so the data are hard to reconcile with H0.

Cramér–von Mises normality test on Sample: n = 40: W² = 0.15, p = .025. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: normality with estimated mean and variance.

Assumptions

Independent identically distributed continuous observations; H0 is a normal distribution with unknown mean and positive variance. Censoring, truncation, clustering and fitted regression residuals require different calibration.

Formula

W2=112n+∑i=1n[ui−2i−12n]2W^2=\frac1{12n}+\sum_{i=1}^{n}\left[u_i-\frac{2i-1}{2n}\right]^2

Parameters and notation

ui=Φ((x(i)−x̄)/s); some implementations use W*²=W²(1+0.5/n).

Structure of the method

Order the sample, evaluate fitted-normal probabilities and sum squared differences from midpoint probability positions, adding the finite-n constant. This integrates discrepancies over the full probability scale rather than deliberately amplifying extreme tails as strongly as Anderson–Darling.

Estimated and nuisance parameters

Estimate normal mean and standard deviation from the tested sample; these fitted nuisance parameters change the reference distribution relative to the known-CDF version.

Settings and design choices

Fix the estimator and finite-sample adjustment, handling of missing observations, significance level, and Monte Carlo budget if used. There is no bandwidth, network depth or trainable hyperparameter in the classical test.

Fitting and adaptation

Use the normality-specific calibration, or simulate normal samples of the same size and repeat location/scale fitting. Refit for each new sample and each simulated replicate. Altering the statistic, using robust estimators or fitting after model selection requires a newly justified calibration; this is statistical recalibration rather than neural fine-tuning.

Sensitivity and robustness

Ties caused by limited measurement precision break the ideal continuous-sample reference. Weakly separated alternatives and small n may evade detection. Check empirical/theoretical CDF plots alongside the p-value; nonrejection does not quantify practical closeness to normality or validate all downstream procedures.

How to use and calibrate

Use the fitted-normal Cramér–von Mises reference or refitted null simulation.

Example application

Evaluate overall normal CDF fit with less tail emphasis than Anderson–Darling.

Interpretation and pitfalls

Watch out

Known-CDF critical values cannot simply be reused after parameter estimation.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Normality is assessed for independent observations. For model diagnostics, test residual assumptions in context; do not automatically choose a downstream test based on a preliminary normality p-value.

Python · invokes R

Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: nortest

# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
    raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
x <- rnorm(60)
print(nortest::cvm.test(x))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
                        text=True, capture_output=True)
print(result.stdout)
if result.stderr:
    print(result.stderr)
result.check_returncode()
R

Validated — Executed successfully in the validation environment · needs nortest

set.seed(2026)
x <- rnorm(60)
print(nortest::cvm.test(x))
Output
	Cramer-von Mises normality test

data:  x
W = 0.031871, p-value = 0.8169

Sources

Statistics guide v4 (historical):
Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 110, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT110.