Cramer-von Mises Test Calculator

Inputs

Cramer-von Mises W-squared0.0556
Correction term 1/(12n)0.0033
Critical value at 5%0.461
Critical value at 1%0.743
How this was calculated
  1. Inputs: summed squared gaps S 0.0523 between the empirical and fitted distribution functions, sample size n 25.
  2. The finite-sample correction is 1 / (12n) = 0.0033.
  3. W-squared = S + 1/(12n) = 0.0523 + 0.0033 = 0.0556.
  4. Against the asymptotic points (0.347 at 10%, 0.461 at 5%, 0.743 at 1%), a W-squared of 0.0556 is judged directly.

Does this sample really come from the distribution you fitted to it? The Cramer-von Mises test answers by adding up the squared gaps between the empirical distribution function and the fitted one, everywhere at once. This calculator takes the finished sum of squared gaps S and the sample size, adds the finite-sample correction 1/(12n), and returns W-squared ready to judge against the asymptotic critical values - 0.347 at 10%, 0.461 at 5%, 0.581 at 2.5% and 0.743 at 1%.

Worked examples

Good fit, n of 25

(0.0523 · 25)

Cramer-von Mises W-squared0.0556
Correction term 1/(12n)0.0033
Critical value at 5%0.461
Critical value at 1%0.743

Poor fit, n of 40

(0.512 · 40)

Cramer-von Mises W-squared0.5141
Correction term 1/(12n)0.0021
Critical value at 5%0.461
Critical value at 1%0.743

Small sample, n of 12

(0.1875 · 12)

Cramer-von Mises W-squared0.1944
Correction term 1/(12n)0.0069
Critical value at 5%0.461
Critical value at 1%0.743

What the test asks

A fitted distribution is a claim about every quantile at once: not just the mean and spread, but the whole shape. The empirical distribution function is the sample's own staircase, stepping up by 1/n at each observation. The Cramer-von Mises statistic integrates the squared vertical distance between the staircase and the fitted curve - with the standard computational form summing the gaps at the observed points and adding 1/(12n). Large W-squared means the staircase and the curve part company somewhere that matters.

The test belongs to the EDF family alongside Kolmogorov-Smirnov and Anderson-Darling, and its personality is the middle one: where KS takes only the single largest gap, CvM accumulates all of them with equal weight, and Anderson-Darling re-weights toward the tails. Equal weighting makes CvM a good general-purpose referee for the centre of the distribution, where most data - and most modelling consequences - live.

  • W-squared = S + 1/(12n), S the summed squared gaps at the data
  • Equal weight across the whole range - no tail emphasis
  • Critical values: 0.347 (10%), 0.461 (5%), 0.581 (2.5%), 0.743 (1%)
  • Parameters estimated from the same data require adjusted tables

Building W-squared from the EDF

Order the sample, transform each point through the fitted distribution to get u-values that should look uniform, then compare each u against its expected staircase position (2i - 1)/(2n). Squaring and summing those gaps gives S. The first worked example's S of 0.0523 at n = 25, plus a correction of 0.0033, gives W-squared of 0.0556 - the staircase hugs the curve, and the fit passes at every tabulated level.

The correction term deserves its sentence: 1/(12n) is the expected contribution of the staircase's own discretisation, and at small n it is not decoration. In the third example, n = 12 makes it 0.0069 against an S of 0.1875 - still small, but at n = 5 it would rival a modest S. Software that drops it quietly inflates small-sample statistics; this page shows it as its own line.

Worked examples

Example 1: Sum of squared EDF gaps S 0.0523; Sample size n 25. Cramer-von Mises W-squared = 0.0556. Supporting values: Correction term 1/(12n) 0.0033; Critical value at 5% 0.461; Critical value at 1% 0.743. Inputs: summed squared gaps S 0.0523 between the empirical and fitted distribution functions, sample size n 25. The finite-sample correction is 1 / (12n) = 0.0033. W-squared = S + 1/(12n) = 0.0523 + 0.0033 = 0.0556. Against the asymptotic points (0.347 at 10%, 0.461 at 5%, 0.743 at 1%), a W-squared of 0.0556 is judged directly.

Example 2: Sum of squared EDF gaps S 0.512; Sample size n 40. Cramer-von Mises W-squared = 0.5141. Supporting values: Correction term 1/(12n) 0.0021; Critical value at 5% 0.461; Critical value at 1% 0.743. Inputs: summed squared gaps S 0.5120 between the empirical and fitted distribution functions, sample size n 40. The finite-sample correction is 1 / (12n) = 0.0021. W-squared = S + 1/(12n) = 0.5120 + 0.0021 = 0.5141. Against the asymptotic points (0.347 at 10%, 0.461 at 5%, 0.743 at 1%), a W-squared of 0.5141 is judged directly.

Example 3: Sum of squared EDF gaps S 0.1875; Sample size n 12. Cramer-von Mises W-squared = 0.1944. Supporting values: Correction term 1/(12n) 0.0069; Critical value at 5% 0.461; Critical value at 1% 0.743. Inputs: summed squared gaps S 0.1875 between the empirical and fitted distribution functions, sample size n 12. The finite-sample correction is 1 / (12n) = 0.0069. W-squared = S + 1/(12n) = 0.1875 + 0.0069 = 0.1944. Against the asymptotic points (0.347 at 10%, 0.461 at 5%, 0.743 at 1%), a W-squared of 0.1944 is judged directly.

Critical values and verdicts

The asymptotic points are the Stephens tabulation used across the EDF family: 0.347, 0.461, 0.581 and 0.743 at the 10%, 5%, 2.5% and 1% levels. The second worked example shows a genuine rejection: S of 0.512 gives W-squared of 0.5141, past the 5% point of 0.461 but short of the 1% point - evidence against the fitted model that is solid, not overwhelming. The third example's 0.1944 clears nothing, not even the 10% point, and the fit stands.

One caution governs all of these verdicts: the tabulated points assume the tested distribution was specified before seeing the data. Fit the parameters from the same sample - the usual case - and the statistic shrinks toward acceptance, because the curve was bent toward the staircase. Stephens published adjusted points and multipliers for the common fitted families (normal, exponential and others); using the raw table after fitting flatters the model, and every careful report says which table it used.

CvM vs Anderson-Darling and Kolmogorov-Smirnov

The three EDF tests are one idea at three weightings. KS keeps the maximum gap: simple, distribution-free in a strong sense, and blind to a hundred small disagreements that never produce one large one. CvM sums the squared gaps flatly. Anderson-Darling divides by the variance of the EDF, u(1-u), which explodes at the edges - making AD the test of choice when the tails carry the risk, as in flood frequency or return extremes.

Power studies generally rank AD first for tail departures, CvM close behind and better in the centre, KS last but simplest to explain. Running CvM beside AD - both are cheap once the u-values exist - separates the diagnoses: a CvM rejection with a quiet AD points at the middle of the distribution; the reverse points at the tails. The statistic on this page is half of that comparison.

Common mistakes

Three errors recur. The first is the fitted-parameter flattery described above. The second is testing a discrete or heavily tied sample against continuous tables: ties break the uniformity of the u-values and the tabulated points no longer apply. The third is reading a non-rejection as confirmation. W-squared of 0.0556 says the data and the model are compatible at this sample size; at n = 25 the test cannot see modest shape errors, and the honest sentence is that the model survived, not that it is true.

There is also a quiet virtue to record. Because the statistic is a sum over the whole sample, its computation is transparent and auditable - every gap can be listed, and the largest contributors identified, which turns a rejection into a diagnosis: the points where the staircase leaves the curve are the places the model is wrong. A test that tells you where to look next is worth more than one that merely votes.

The statistic's history is worth a paragraph because it explains its form. Cramer proposed the integrated squared difference in 1928 as a measure of distance between distributions; von Mises arrived at the same functional from the theory of statistical functions, and the computational form with the (2i - 1)/(2n) staircase positions and the 1/(12n) term is the discrete shadow of that integral. The test was, in other words, an integral before it was a sum - which is why it weights the whole range democratically, and why its power profile sits where it does between the maximum-gap and tail-weighted alternatives.

In modern practice the test often appears in disguise: as the distance a quantile-quantile plot summarises, as the objective in minimum-distance estimation, and inside the two-sample version that compares two empirical distributions directly rather than a sample against a model. The two-sample form shares the critical-value logic with an adjusted scaling. A user who has understood the one-sample statistic on this page - gaps, squares, the correction, the table - already owns the machinery of the whole family.

A final practical point concerns ties and rounding in the data themselves. The u-values are computed from the fitted distribution at the recorded precision; heavily rounded data produce repeated u-values whose gaps no longer follow the continuous theory, inflating or deflating S in ways the critical table cannot price. The repair is to acknowledge the grouping - jittering is not a repair, merely a concealment - or to use a test designed for grouped data. The statistic's transparency helps here too: the ordered u-values can be listed and inspected, and a staircase with visible steps in the wrong places announces the problem before the verdict is read.

That auditability is the statistic's closing virtue: every term in the sum is a single observation's disagreement with the model, listed in order, so the test never asks to be believed on authority it has not shown.

FAQs

What W-squared does the first worked example give?

0.0556 - S of 0.0523 plus the 1/(12n) correction of 0.0033 at n = 25. Far below the 10% point of 0.347, the fit is comfortably accepted.

What is the 1/(12n) correction in the first example?

0.0033. It prices the staircase's own discretisation and matters most at small n - 0.0069 in the n = 12 third example.

What is the 5% critical value?

0.461, from Stephens' asymptotic tabulation: 0.347 at 10%, 0.461 at 5%, 0.581 at 2.5% and 0.743 at 1%.

What is the 1% critical value?

0.743. The second example's 0.5141 passes the 5% point but not this one - a solid rejection, not an overwhelming one.

What W-squared does the poor-fit second example give?

0.5141 - S of 0.512 at n = 40. The fitted model is rejected at the 5% level.

What W-squared does the small-sample third example give?

0.1944 at n = 12 - below even the 10% point, so the fit stands, with the small sample's limited power kept in mind.

Sources

Related calculators

Anderson-Darling Test Calculator
The Anderson-Darling normality test: Stephens' adjusted A-squared statistic and its piecewise p-value, with the standard critical values.
Kolmogorov-Smirnov Test Calculator
The one-sample Kolmogorov-Smirnov test: Stephens-adjusted lambda and the series p-value from the D statistic and sample size, with the 5% and 1% critical values.
D'Agostino-Pearson Normality Test Calculator
The D'Agostino-Pearson omnibus K-squared normality test, combining the D'Agostino skewness transform and the Anscombe-Glynn kurtosis transform.