where the discontinuities in g are more than some distance
e apart. This, however, requires knowledge that
g is a step function as well as of the nature of its support
(specifically, the break-points). As a result, we
implement the Kolmogorov-Smirnov test statistic for
discrete null distributions by requiring the complete
specification of the null distribution.
Having obtained the test statistic, the p-value must
then be calculated. When an exact p-value is required
for smaller sample sizes, the methodology in Conover
(1972) is used in for one-sided tests. For two-sided
tests, the methods presented in Gleser (1985) lead to
exact two-sided p-values. This requires the calculation
of rectangular probabilities for uniform order
statistics as discussed by Niederhausen (1981). Full
details of the calculations are contained in source code
of our revised function ks.test() and in the papers
of Conover and Gleser.
For larger sample sizes (or when requested for
smaller sample sizes), the classical Kolmogorov-
Smirnov test is used and is known to produce conservative
p-values for discrete distributions; the revised
ks.test() supports estimation of p-values via simulation
if desired.