# Critical values for Cramér-von Mises goodness of fit test

I'm currently working on a Crow-AMSAA growth reliability model and to test the goodness of the estimated parameters, I need the critical values for the Cramér-von Mises test. Is it possible to import these critical values into Mathematica? Many sites are showing the values listed as image (click the image to enlarge)

Is there a way to get this without manually typing out the numbers? As I understood it, it is an empirical distribution and it cannot be calculated. Is that correct?

## Detailed explanation

The reason I'm asking for the table of critical values is because the test statistic slightly changes depending on the data (time vs. failure terminated) and I cannot account for this with the CramerVonMisesTest. In addition, I cannot get the same test static values with the built-in function that I get with manual calculation.

Here is a quick example. The reliability analysis is used when we want to model when failures appear in a system. Therefore, we have a list of time events that follow an inhomogeneous Poisson process. Here is how we could sample some data:

lambda = 0.001;
beta = 2.3;
tend = 200;

intensF[t_] := lambda*beta*t^(beta - 1)

SeedRandom[1];
tempData =
RandomFunction[
InhomogeneousPoissonProcess[intensF[t], t], {0, tend}];

events = tempData["TimeList"][[1]];


Now the theory goes that this is linear in a log-log scale

Show[
ListLogLogPlot@Transpose[{events, Range[Length[events]]}],
LogLogPlot[lambda*t^beta, {t, 0, tend}]
]


The test statistic $C^2_M$ as given in the linked page for a time terminated list of events is

c[events_, beta_] := Module[{m = Length[events], β = beta},
1/(12 m) +
Sum[((events[[i]]/Last[events])^β - (2 i - 1)/(2 m))^2, {i, m}]
];


and we get

c[events, beta]
(* 0.206301 *)


Note that I used the exact beta. Usually, one gets an unbiased beta purely from the data without knowing the exact value.

My understanding is now, that I should be able to get a similar test statistic when I use the CramerVonMisesTest with a PoissonDistribution whose mean can be calculated by integrating intensF, but I wasn't able to produce any meaningful result. Any hints on this?

• The following article might be helpful if you're looking to construct a table from scratch: The Exact and Asymptotic Distributions of Cramer-von Mises Statistics. Sandor Csorgo and Julian J. Faraway. Journal of the Royal Statistical Society. Series B (Methodological) Vol. 58, No. 1 (1996), pp. 221-234. – JimB Apr 11 '17 at 4:49
• @Jim, I had a look; Mathematica can certainly compute those, but it's clear why most people resort to interpolating a table... :o – J. M. will be back soon Apr 11 '17 at 5:53

Is an interpolation function all that you want for your first question? Here the imported numbers from that table used to construction an interpolation function:

α = {0.20, 0.15, 0.10, 0.05, 0.01}
cvm = {{2, 0.138, 0.149, 0.162, 0.175, 0.186}, {3, 0.121, 0.135, 0.154, 0.184, 0.23},
{4, 0.121, 0.134, 0.155, 0.191, 0.28}, {5, 0.121, 0.137, 0.160, 0.199, 0.30},
{6, 0.123, 0.139, 0.162, 0.204, 0.31}, {7, 0.124, 0.140, 0.165, 0.208, 0.32},
{8, 0.124, 0.141, 0.165, 0.210, 0.32}, {9, 0.125, 0.142, 0.167, 0.212, 0.32},
{10, 0.125, 0.142, 0.167, 0.212, 0.32}, {11, 0.126, 0.143, 0.169, 0.214, 0.32},
{12, 0.126, 0.144, 0.169, 0.214, 0.32}, {13, 0.126, 0.144, 0.169, 0.214, 0.33},
{14, 0.126, 0.144, 0.169, 0.214, 0.33}, {15, 0.126, 0.144, 0.169, 0.215, 0.33},
{16, 0.127, 0.145, 0.171, 0.216, 0.33}, {17, 0.127, 0.145, 0.171, 0.217, 0.33},
{18, 0.127, 0.146, 0.171, 0.217, 0.33}, {19, 0.127, 0.146, 0.171, 0.217, 0.33},
{20, 0.128, 0.146, 0.172, 0.217, 0.33}, {30, 0.128, 0.146, 0.172, 0.218, 0.33},
{60, 0.128, 0.147, 0.173, 0.220, 0.33}, {100, 0.129, 0.147, 0.173, 0.220, 0.34}};

critCVM = Interpolation[Flatten[Table[{{cvm[[i, 1]], α[[j]]}, cvm[[i, j + 1]]},
{j, 5}, {i, Length[cvm]}], 1]]

critCVM[35, 0.2]
(* 0.123843 *)

• You are a life saver :) Thanks. – halirutan Apr 11 '17 at 11:05