From p.dalgaard@biostat.ku.dk  Fri Oct 26 23:43:43 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 27 Oct 2001 00:43:43 +0200
Subject: [Rd] ks.test (PR#1004)
In-Reply-To: <200110262210.AAA04294@pubhealth.ku.dk>
References: <200110262210.AAA04294@pubhealth.ku.dk>
Message-ID: <x2k7xit42o.fsf@blueberry.kubism.ku.dk>

charlie@muskrat.stat.umn.edu writes:

> For example, Example 5.4 in Hollander and Wolfe (Nonparametric Statistical,
> Methods, 2nd ed., Wiley, 1999, pp. 180-181)
> 
> R Version 1.3.1 (SuSE Linux 7.1)
> 
> > X <- read.table(url("http://www.stat.umn.edu/geyer/5601/hwdata/t5-7.txt"),
> +     header = TRUE)
> > names(X)
> [1] "x" "y"
> > attach(X)
> > ks.test(x, y)
>  
>         Two-sample Kolmogorov-Smirnov test
>  
> data:  x and y
> D = 0.6, p-value = 0.01234
> alternative hypothesis: two.sided
> 
> Not hardly.  Hollander and Wolfe say the exact P-value is 0.0524.  Note

Here's part of the problem:

Browse[1]> .C("psmirnov2x", p = as.double(STATISTIC), as.integer(n.x),
as.integer(n.y), PACKAGE = "ctest")$p
[1] 0.9876594
Browse[1]> .C("psmirnov2x", p = as.double(0.6), as.integer(n.x),
as.integer(n.y), PACKAGE = "ctest")$p
[1] 0.9475524
Browse[1]> STATISTIC
[1] 0.6

Perplexed? The reason is of course that

Browse[1]> STATISTIC-0.6
[1] 1.110223e-16

and the KS distribution is discontinuous, so the point probability at
0.6 didn't get counted. Looks like we need a fudge factor.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] ks.test (PR#1004)
Peter Dalgaard BSA