Prof Brian D Ripley writes:
On Thu, 8 Apr 1999, David Middleton wrote:
This question is mainly aimed at Kurt Hornik as author of the ctest package,
but I'm cc'ing it to r-help as I suspect there will be other valuable
opinions out there.
I have been attempting 2 sample Kolmogorov-Smirnov tests using the ks.test
function from the ctest package (ctest v.0.9-15, R v.0.63.3 win32). I am
comparing fish length-frequency distributions. My main reference for the KS
test at present is Sokal & Rohlf, Biometry (2nd edn), pages 440-445).
The individuals in my samples are measured to the nearest 0.5cm and so in
most samples there are several identical length values. It appears that the
KS test statistic D is being overestimated (and the p value therefore
underestimated).
If the data are discretized the KS test does not have the standard
(distribution-free) distribution. `Distribution-free' here means
independent samples from a continuous distribution. So the KS test is
not IMHO appropriate in your problem. My view is that the function
should warn you off, and not give a p-value if it finds ties. It might
be good to construct the exact statistic, though.