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

**Kurt Hornik
**
Kurt.Hornik@ci.tuwien.ac.at

*Fri, 29 Jun 2001 08:37:24 +0200*

>>>>>* ripley writes:
*
>* 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.
*
Thanks for doing. I had received a similar private bug report but had
not gotten to fixing this.
>* Neither value agrees well with S-PLUS 6, which gives
*
>>* source("dumpdata.R")
*>>* ks.gof(x, y)$p
*>* [1] 1.453458e-07
*
Strange because the underlying algorithm should be the same. Have you
tried R vs Splus on larger samples (say, 100 each)?
-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._