Tal Galili
2010-Mar-13 19:34 UTC
[R] What can I use instead of ks.test for the binomial distribution ?
Hello all, A friend just showed me how ks.test fails to work with pbinom for small "size". Example: x<-rbinom(10000,10,0.5) x2<-rbinom(10000,10,0.5) ks.test(x,pbinom,10,0.5) ks.test(x,pbinom,size = 10, prob= 0.5) ks.test(x,x2) The tests gives significant p values, while the x did come from binom with size = 10 prob = 0.5. What test should I use instead ? Thanks, Tal ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- [[alternative HTML version deleted]]
David Winsemius
2010-Mar-13 20:04 UTC
[R] What can I use instead of ks.test for the binomial distribution ?
On Mar 13, 2010, at 2:34 PM, Tal Galili wrote:> Hello all, > > A friend just showed me how ks.test fails to work with pbinom for > small > "size". > Example: > > x<-rbinom(10000,10,0.5) > x2<-rbinom(10000,10,0.5) > ks.test(x,pbinom,10,0.5) > ks.test(x,pbinom,size = 10, prob= 0.5) > ks.test(x,x2) > > > The tests gives significant p values, while the x did come from > binom with size = 10 prob = 0.5.The first sentence of Details in the ks.test help page: "If y is numeric, a two-sample test of the null hypothesis that x and y were drawn from the same _continuous_ distribution is performed." (_continuous_ in italics.) This has come up in r-help so frequently that I nominate it for addition to the FAQ. Searching with RSiteSearch() on "ks.test" with "ties" or "continuous" should bring up useful commentary from experts. -- David.> > What test should I use instead ? > > > Thanks, > Tal > > > [[alternative HTML version deleted]]David Winsemius, MD West Hartford, CT