[R] Problems with ks.test

Emanuele Mazzola mathematician4 at hotmail.com
Fri Feb 3 15:36:43 CET 2006


Hi everybody,

while performing ks.test for a standard exponential distribution on samples 
of dimension 2500, generated everytime as new, i had this strange behaviour:

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0147, p-value = 0.6549
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.019, p-value = 0.3305
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0171, p-value = 0.4580
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0143, p-value = 0.6841
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0145, p-value = 0.6684
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0123, p-value = 0.8435
alternative hypothesis: two.sided

>data<-rexp(2500,0.4)
>ks.test(data,"pexp",0.4)

	One-sample Kolmogorov-Smirnov test

data:  data
D = 0.0186, p-value = 0.3532
alternative hypothesis: two.sided


It seems kind of strange to me that max p-value obtained is 0.8435 and all 
the best i can have from the rest is a 0.66-0.68.
I'm probably not so expert in running this kind of test, but am I doing 
something wrong?
I would expect p values ranging from 0.75 (to be kind) to 0.9, 0.95. How is 
this possible?

Thank you in advance for your answers.
See you soon
EM




More information about the R-help mailing list