Skip to content
Prev 85704 / 398506 Next

Problems with ks.test

The distribution of p-values should be uniform under
the null hypothesis.  When I do:

 > jj <- numeric(10000)
 > for(i in 1:10000) jj[i] <- ks.test(rexp(2500, .4), 'pexp', .4)$p.value
Warning messages:
1: cannot compute correct p-values with ties in: ks.test(rexp(2500, 
0.4), "pexp", 0.4)
2: cannot compute correct p-values with ties in: ks.test(rexp(2500, 
0.4), "pexp", 0.4)
3: cannot compute correct p-values with ties in: ks.test(rexp(2500, 
0.4), "pexp", 0.4)
4: cannot compute correct p-values with ties in: ks.test(rexp(2500, 
0.4), "pexp", 0.4)
 > hist(jj, 50, col='yellow'); abline(h=200, col='green')

I get a histogram that looks reasonably flat to me.

Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")
Emanuele Mazzola wrote: