Skip to main content
QUICK REVIEW

[Paper Review] A comparison of the discrete Kolmogorov-Smirnov statistic and the Euclidean distance

Jacob Carruth, Mark Tygert|arXiv (Cornell University)|Jun 27, 2012
Statistical Mechanics and EntropyPhysics and Astronomy24 references4 citations
TL;DR

This paper compares the discrete Kolmogorov-Smirnov (KS) statistic and Euclidean distance as goodness-of-fit measures for discrete probability distributions. It demonstrates that the KS statistic is more powerful when data has a natural ordering (ordinal), while the Euclidean distance is more reliable and interpretable when no such ordering exists (nominal), based on theoretical analysis and Monte Carlo simulations with 4 million trials across multiple datasets.

ABSTRACT

Goodness-of-fit tests gauge whether a given set of observations is consistent (up to expected random fluctuations) with arising as independent and identically distributed (i.i.d.) draws from a user-specified probability distribution known as the "model." The standard gauges involve the discrepancy between the model and the empirical distribution of the observed draws. Some measures of discrepancy are cumulative; others are not. The most popular cumulative measure is the Kolmogorov-Smirnov statistic; when all probability distributions under consideration are discrete, a natural noncumulative measure is the Euclidean distance between the model and the empirical distributions. In the present paper, both mathematical analysis and its illustration via various data sets indicate that the Kolmogorov-Smirnov statistic tends to be more powerful than the Euclidean distance when there is a natural ordering for the values that the draws can take -- that is, when the data is ordinal -- whereas the Euclidean distance is more reliable and more easily understood than the Kolmogorov-Smirnov statistic when there is no natural ordering (or partial order) -- that is, when the data is nominal.

Motivation & Objective

  • To evaluate and compare the statistical power and reliability of the discrete Kolmogorov-Smirnov (KS) statistic and Euclidean distance in goodness-of-fit testing for discrete distributions.
  • To determine under what conditions each test statistic—KS (cumulative, ordering-dependent) and Euclidean (non-cumulative, ordering-invariant)—is more appropriate.
  • To provide empirical and theoretical guidance on selecting the optimal discrepancy measure based on the presence or absence of a natural ordering in the data bins.
  • To illustrate the performance differences using real-world datasets, including Rhesus haplotypes, candy color frequencies, and genetic equilibrium tests.
  • To support the recommendation that KS is preferable for ordinal data, while Euclidean distance is more robust and interpretable for nominal data with no inherent order.

Proposed method

  • The study defines two discrepancy measures: the discrete KS statistic, which computes the maximum absolute difference between cumulative distribution functions of the model and empirical distributions, and the Euclidean distance, which computes the L2 norm of the difference between the two distributions.
  • The KS statistic is computed as $ d_1(a,b) = \max_{1\leq k\leq m} \left| \sum_{j=1}^{k} a^{(j)} - \sum_{j=1}^{k} b^{(j)} \right| $, while the Euclidean distance is $ d_2(a,b) = \sqrt{\sum_{j=1}^{m} (a^{(j)} - b^{(j)})^2} $.
  • P-values are computed via Monte Carlo simulations: for each test, 4,000,000 i.i.d. samples are drawn from the assumed model $ p_0(\hat{\theta}) $, and the proportion of simulated discrepancies exceeding the observed discrepancy is taken as the P-value.
  • The analysis evaluates both statistics across four real datasets: a test of randomness, Poissonity, Hardy-Weinberg equilibrium, and uniformity, with varying bin orderings to assess sensitivity.
  • For datasets with no natural ordering (e.g., candy colors), multiple pseudorandom orderings are tested to evaluate the stability of the KS P-values, while the Euclidean distance remains invariant.
  • The study compares results with classical statistics like $ \chi^2 $, $ G^2 $, and Freeman-Tukey, confirming that Euclidean distance behaves similarly to other order-invariant tests.

Experimental results

Research questions

  • RQ1When is the discrete Kolmogorov-Smirnov statistic more powerful than the Euclidean distance in goodness-of-fit testing for discrete distributions?
  • RQ2How does the presence or absence of a natural ordering in data bins affect the reliability and interpretability of the KS statistic versus the Euclidean distance?
  • RQ3To what extent do P-values from the KS statistic vary under different orderings of bins when no natural order exists?
  • RQ4How do the P-values from the Euclidean distance compare to those of classical order-invariant statistics like $ \chi^2 $ and $ G^2 $ in the absence of bin ordering?
  • RQ5Can data-dependent bin ordering significantly alter the behavior of the KS statistic, and if so, how does this affect inference?

Key findings

  • The Kolmogorov-Smirnov statistic is more powerful than the Euclidean distance when data has a natural ordering (e.g., ordinal data), as it leverages cumulative information and is sensitive to deviations in the tail or middle of the distribution.
  • In the absence of a natural ordering (e.g., nominal data such as candy colors), the Euclidean distance produces more stable and reliable P-values than the KS statistic, which varies significantly across different orderings of the same bins.
  • For the candy color dataset (Table 2), the Euclidean distance yielded a P-value of 0.770, matching the $ \chi^2 $ statistic exactly due to the direct proportionality between Euclidean distance and the square root of $ \chi^2 $, confirming its invariance to bin ordering.
  • In the Rhesus haplotype dataset, the KS P-values varied widely across 10 pseudorandom orderings (Figure 5), while the Euclidean distance remained constant, demonstrating its robustness under ordering uncertainty.
  • For the test of uniformity (candy colors), the Euclidean distance P-value was 0.770, while classical statistics like $ \chi^2 $, $ G^2 $, and Freeman-Tukey yielded similar values (0.770, 0.766, 0.755), confirming consistency with established order-invariant tests.
  • The KS statistic tends to emphasize low-frequency discrepancies and can obscure high-frequency differences due to its cumulative nature, whereas the Euclidean distance treats all bin deviations equally, making it more transparent and interpretable in unordered settings.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.