[R] Question about Kolmogorov-Smirnov Test

From: Ricardo Ríos <ricardo.rios.sv_at_gmail.com>
Date: Tue, 25 Nov 2008 21:08:53 -0600


Hi wizards

I have the following code for a Kolmogorov-Smirnov Test:

z<-c(1.6,10.3,3.5,13.5,18.4,7.7,24.3,10.7,8.4,4.9,7.9,12,16.2,6.8,14.7) ks.test(z,"pexp",1/10)$statistic

The Kolmogorov-Smirnov statistic is:

       D
0.293383

However, I have calculated the Kolmogorov-Smirnov statistic with the following R code:

z<-c(1.6,10.3,3.5,13.5,18.4,7.7,24.3,10.7,8.4,4.9,7.9,12,16.2,6.8,14.7)
a<-sort(z)
d<- pexp(a, rate = 1/10, lower.tail = TRUE, log.p = FALSE)
w=numeric(length = length(a))
for(i in 1:length(a)) w[i]=i/15
max(abs(w-d))

But I have obtained the following result:

[1] 0.2267163

Why these results are not equal?

Thanks in advance

-- 
http://ricardorios.wordpress.com/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 26 Nov 2008 - 03:12:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Nov 2008 - 14:00:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive