Kolmogorov-Smirnov test
If you inspect the body of the function ks.test
you will see the following line somewhere in the body:
if (length(unique(x)) < n) {
warning("ties should not be present for the Kolmogorov-Smirnov test")
TIES <- TRUE
}
This tells you that when the number of unique elements in x is below the number of elements - you will get this warning. In other words if your vector has duplicate entries - you will get the warning.
Most likely what happened is that when n > 100 there are more chances to get a duplicated value in there somewhere compared with using n = 100. Since you are repeating this thousands of times the probability for having two identical values in x goes up.
As an example this code didn't give me any warning:
set.seed(1234)
smth <- replicate(100000, ks.test(runif(101),y="punif"))
Egodym
Updated on June 14, 2022Comments
-
Egodym almost 2 years
I'm using the R function
ks.test()
to test the Uniform distribution of the R random number generator. I'm using the following code:replicate(100000, ks.test(runif(n),y="punif")
.When
n
is less than or equal to 100 it works, but whenn
is greater than 100 I get the following Warning Message:In ks.test(runif(100000), y = "punif") : ties should not be present for the Kolmogorov-Smirnov test.
What are those "ties"?
-
Geva Tal almost 9 yearsBut, what if my data set contains repeating values?
-
Jeremy McNees over 7 yearsHave a similar question. Does this mean the test is not valid, if there are ties?
-
Karolis Koncevičius over 7 years@JeremyMcNees Please consider looking for an answer in Stats.StackExchange. HERE is on example that might help you.