1
$\begingroup$

In one-sample Kolmogorov-Smirnov test one tests whether sample $X = (X_1,\dots,X_n)$ come from theoretical distribution by computing $D_n = \sup_{x} |F_n(x) - F(x)|$, where $F_n(x)$ denotes the empirical cumulative distribution function of $X$ and $F(x)$ denotes the cumulative distribution function of a prespecified theoretical distribution.

It is known that in case when $F(x)$ is continuous, the distribution of $D_n$ does not depend on $F(x)$. In classical KS-test it is assumed that distibutions are continuous. It is possible, however, to perform test for purely discrete $F(x)$. In that case it's hard to compute $P(D_n \leq q |H_0)$ (p-value), where $H_0$ is a null hypothesis that $X$ comes from $F(x)$.

Dimitrova, D. S et al. study how to compute p-value for continuous, discrete or mixed $F(x)$ - http://openaccess.city.ac.uk/id/eprint/18541/. Let's focus on purely discrete CDF. In that case $F(x)$ must be non-decreasing and right-continuous, with countable number of jumps. If it's true, one could compute $D_n$ and corresponding p-value for purely discrete $F(x)$ using function KSgeneral::disc_ks_test() from package KSgeneral (implemented by the same authors) in R.

Is it possible to use this implementation for two-sample KS-test, when we get samples $X = (X_1,\dots,X_n)$ and $Y = (Y_1,\dots,Y_m)$, to test whether these two samples come from the same discrete distribution? Let $F(x)$ be empirical cumulative distribution function of $Y$. Then, I believe, KSgeneral::disc_ks_test() is going to perform two-sample test for $X$ and $Y$, am I wrong?

$\endgroup$
0
$\begingroup$

If you're asking "can I take a one sample goodness of fit test and replace the theoretical cdf with a sample cdf (ecdf) and have it be an essentially correctly-sized two sample test?" the answer is no; the test statistic will behave differently (there's more random variation in the second case).

If you're asking "can I take a one sample goodness of fit test and replace the theoretical cdf with a sample cdf (ecdf) and then calculate a new null distribution for that case and have it be an essentially correctly-sized two sample test?" the answer is yes.

The fact that its for a discrete case doesn't change that assessment.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.