[R] What can I use instead of ks.test for the binomial distribution ?

David Winsemius dwinsemius at comcast.net
Sat Mar 13 21:04:45 CET 2010


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



More information about the R-help mailing list