[R] KS test from ctest package

Prof Brian D Ripley ripley at stats.ox.ac.uk
Fri Apr 9 07:51:34 CEST 1999


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.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list