I am reading about the Kolmogrov-Smirnov tests from the book Probability and Statistics by DeGroot and Schervish. In the initial few lines on this topic, the authors state the following:-
Suppose that the random variables X1,...,Xn form a random sample from some continuous distribution, and let x1,...,xn denote the observed values of X1,...,Xn. Since the observations come from a continuous distribution, there is probability 0 that any two of the observed values x1,...,xn will be equal. Therefore, we shall assume for simplicity that all n values are different.
My question is - For a sample from a continuous distribution, will be probability of two sample values being equal be exactly zero or approximately zero? If it is the former, can you please give me a hint regarding how to prove it mathematically?
Intuitively, the probability being approximately zero makes sense as however rare it might be, it is possible to have two equal values generated from a distribution. I tried to check this computationally by running a simple R script (written below) and after running it a 100 times, I got the probability to be equal to zero in all instances. May be running it a few million times might produce better results but that would be cruel on my Dell Core i3, 2GB RAM laptop.
probOfCommonObs <- rep(0, 100)
noOfCommonObs <- rep(0, 100)
for(i in 1:100)
{
gaussianSample <- rnorm(1000, sample(1:50, 1), sample(1:50, 1))
for(j in 1:999)
{
for(k in (j+1):1000)
{
if(gaussianSample[j] == gaussianSample[k])
{
noOfCommonObs[i] <- noOfCommonObs[i] + 1
}
}
}
probOfCommonObs[i] <- noOfCommonObs[i]/1000
}
noOfCommonObs
probOfCommonObs
I guess a theoretical explanation would help clarify my doubt and any help would be really appreciated.
I have kept the posting instructions in mind while writing this post but would like to apologise if I have made any mistakes. Thanks!