ripley@stats.ox.ac.uk
2001-Jun-29 05:49 UTC
[Rd] KS test in R.1.3.0 has incorrect p-values. (PR#1004)
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Kurt Hornik
2001-Jun-29 06:37 UTC
[Rd] KS test in R.1.3.0 has incorrect p-values. (PR#1004)
>>>>> 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-07Strange 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._