[Rd] KS test in R.1.3.0 has incorrect p-values. (PR#1004)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Fri, 29 Jun 2001 07:49:24 +0200 (MET DST)


Based on a report to the Windows maintainers from Richard Rowe
<Richard.Rowe@jcu.edu.au>:

NEWS for 1.3.0 says

    o   Exact p-values are available for the two-sided two-sample
        Kolmogorov-Smirnov test.

I think the (new) p-values are computed but are backwards:

> set.seed(123)
> x <- rnorm(50)
> y <- runif(50)
> ks.test(x,y, exact=T)$p
[1] 1
> 1 - ks.test(x,y, exact=T)$p
[1] 4.047605e-08
> ks.test(x,y, exact=F)$p
[1] 3.099506e-07
> y<-rnorm(50)
> ks.test(x,y, exact=T)$p
[1] 0.02015456
> ks.test(x,y, exact=F)$p
[1] 0.9971923

I'll commit the obvious fix unless anyone knows better.  Neither value
agrees well with S-PLUS 6, which gives

> source("dumpdata.R")
> ks.gof(x, y)$p
[1] 1.453458e-07


-- 
Brian D. Ripley,                  ripley@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-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._