On Thu, 6 Oct 2011, francogrex wrote:
x <- runif(100)
y <- runif(100)
ks.test(x,y)
Two-sample Kolmogorov-Smirnov test
data: x and y
D = 0.11, p-value = 0.5806
alternative hypothesis: two-sided
ok I expected that, but:
ks.test(runif(100), "runif")
One-sample Kolmogorov-Smirnov test
data: runif(100)
D = 0.9106, p-value < 2.2e-16
alternative hypothesis: two-sided
How come?
Because you didn't read the docs, or didn't follow them, or mistyped. The
docs say
y: either a numeric vector of data values, or a character string
naming a cumulative distribution function or an actual
cumulative distribution function such as 'pnorm'. Only
continuous CDFs are valid.
So you would want
ks.test(runif(100), "punif")
Best,
Z
--
View this message in context:
http://r.789695.n4.nabble.com/KS-test-and-theoretical-distribution-tp3878640p3878640.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@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.
______________________________________________
R-help@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.