The NPAR1WAY Procedure

Tests Based on the Empirical Distribution Function

If you specify the EDF option, PROC NPAR1WAY computes tests based on the empirical distribution function. These include the Kolmogorov-Smirnov and Cramér–von Mises tests, and also the Kuiper test for two-sample data. This section gives formulas for these test statistics. For further information about the formulas and the interpretation of EDF statistics, see Hollander and Wolfe (1999) and Gibbons and Chakraborti (2010). For information about the k-sample analogs of the Kolmogorov-Smirnov and Cramér–von Mises statistics, see Kiefer (1959).

The empirical distribution function (EDF) of a sample $ \{ x_ j\} $, $ j=1,2,\ldots ,n$, is defined as

\[  F(x) = \frac{1}{n} (\mbox{number of} \hspace{.05in} x_ j \leq x) = \frac{1}{n} \sum _{j=1}^ n I(x_ j \leq x)  \]

where $I(\cdot )$ is an indicator function. PROC NPAR1WAY uses the subsample of values within the ith class level to generate an EDF for the class, $F_ i$. The EDF for the overall sample, pooled over classes, can also be expressed as

\[  F(x) = \frac{1}{n} \sum _ i \left( n_ i F_ i(x) \right)  \]

where $n_ i$ is the number of observations in the ith class level, and n is the total number of observations.

Kolmogorov-Smirnov Test

The Kolmogorov-Smirnov statistic measures the maximum deviation of the EDF within the classes from the pooled EDF. PROC NPAR1WAY computes the Kolmogorov-Smirnov statistic as

\[  \mi{KS} = \max _ j \sqrt { ~  \frac{1}{n} ~  \sum _ i n_ i \left( F_ i(x_ j) - F(x_ j) \right)^2 ~  } \quad \mr{where} \hspace{.10in} j = 1,2,\ldots ,n  \]

The asymptotic Kolmogorov-Smirnov statistic is computed as

\[  \mi{KS_ a} = \mi{KS} \times \sqrt {n}  \]

For each class level i and overall, PROC NPAR1WAY displays the value of $F_ i$ at the maximum deviation from F and the value $\sqrt {n_ i} ~  (F_ i-F)$ at the maximum deviation from F. PROC NPAR1WAY also gives the observation where the maximum deviation occurs.

If there are only two class levels, PROC NPAR1WAY computes the two-sample Kolmogorov-Smirnov test statistic D as

\[  D = \max _ j \left| F_1(x_ j) - F_2(x_ j) \right| \quad \mr{where} \hspace{.10in} j = 1,2,\ldots ,n  \]

The p-value for this test is the probability that D is greater than the observed value d under the null hypothesis of no difference between class levels (samples). PROC NPAR1WAY computes the asymptotic p-value for D by using the approximation

\[  \mr{Prob} ( D > d ) = 2 ~  \sum _{i = 1}^{\infty } (-1)^{(i-1)} ~  e^{(-2i^2 ~  z^2)}  \]

where

\[  z = d \sqrt { n_1 ~  n_2 ~  / ~  n }  \]

For more information, see Hodges (1957).

If you specify the D option, or if you request exact Kolmogorov-Smirnov p-values by specifying the KS option in the EXACT statement, PROC NPAR1WAY also computes the one-sided Kolmogorov-Smirnov statistics D+ and D– for two-sample data as

\[  D+ = \max _ j \left( F_1(x_ j) - F_2(x_ j) \right) \quad \mr{where} \hspace{.10in} j = 1,2,\ldots ,n  \]
\[  D- = \max _ j \left( F_2(x_ j) - F_1(x_ j) \right) \quad \mr{where} \hspace{.10in} j = 1,2,\ldots ,n  \]

The asymptotic probability that D+ is greater than the observed value $d^+$, under the null hypothesis of no difference between the two class levels, is computed as

\[  \mr{Prob} ( D+ > d^+ ) = e^{-2z^2} \quad \mr{where} \hspace{.10in} z = d^+ \sqrt { n_1 ~  n_2 ~  / ~  n }  \]

Similarly, the asymptotic probability that D– is greater than the observed value $d^-$ is computed as

\[  \mr{Prob} ( D- > d^- ) = e^{-2z^2} \quad \mr{where} \hspace{.10in} z = d^- \sqrt { n_1 ~  n_2 ~  / ~  n }  \]

To request exact p-values for the Kolmogorov-Smirnov statistics, you can specify the KS option in the EXACT statement. For more information, see the section Exact Tests.

Cramér–von Mises Test

The Cramér–von Mises statistic is defined as

\[  \mi{CM} = \frac{1}{n^2} ~  \sum _ i \left( n_ i \sum _{j=1}^ p t_ j \left( F_ i(x_ j) - F(x_ j ) \right)^2 \right)  \]

where $t_ j$ is the number of ties at the jth distinct value and p is the number of distinct values. The asymptotic value is computed as

\[  \mi{CM}_ a = \mi{CM} \times n  \]

PROC NPAR1WAY displays the contribution of each class level to the sum $\mi{CM}_ a$.

Kuiper Test

For data with two class levels, PROC NPAR1WAY computes the Kuiper statistic, its scaled value for the asymptotic distribution, and the asymptotic p-value. The Kuiper statistic is computed as

\[  K = \max _ j \left( F_1(x_ j) - F_2(x_ j) \right) - \min _ j \left( F_1(x_ j) - F_2(x_ j) \right) \quad \mr{where} \hspace{.10in} j = 1,2,\ldots ,n  \]

The asymptotic value is

\[  K_ a = K \sqrt { n_1 ~  n_2 ~  / ~  n }  \]

PROC NPAR1WAY displays the value of $( \max _ j \left| F_1(x_ j) - F_2(x_ j) \right| )$ for each class level.

The p-value for the Kuiper test is the probability of observing a larger value of $K_ a$ under the null hypothesis of no difference between the two classes. PROC NPAR1WAY computes this p-value according to Owen (1962, p. 441).