ADescribe · Guide test 110
Cramér–von Mises normality test
Tests normality using an integrated squared discrepancy from a fitted normal distribution.
Do it in CodeSplash
In the app, set it up in Analyze with one of these methods:
- Normality tests (battery) — Is a numeric variable (or each group of it) plausibly normal — by tests and by shape?
- Normality test (one test) — Is a numeric variable (or each group of it) plausibly normally distributed?
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
Sinh–arcsinh shape: 0 is symmetric.
Below 1: heavier tails than normal; 1 with ε = 0 is exactly normal.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how W² varies across samples when H₀ is true, Stephens' approximation for estimated mean and SD (Stephens' formula for p).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .025).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- normal CDF at the standardized order statistics
- 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 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
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.
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()
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
- nortest — nortest · cvm.testAuthor documentation/source reviewed: nortest 1.0-4.search.r-project.org
- cvm.testsearch.r-project.org
- 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.