Solved – “Ties should not be present” in one-sample Kolmgorov-Smirnov test in R

kolmogorov-smirnov testties

I am going to use the Kolmogorov-Smirnov test to test normality of MYDATA in R. This is an example of what I do

 ks.test(MYDATA,"pnorm",mean(MYDATA),sd(MYDATA))

Here is the result R gives me:

 data:  MYDATA
 D = 0.13527, p-value = 0.1721
 alternative hypothesis: two-sided

 Warning message:
 In ks.test(MYDATA, "pnorm", mean(MYDATA), sd(MYDATA)) :
    ties should not be present for the Kolmogorov-Smirnov test

I think there is a problem, what does "ties" mean in this warning?

Best Answer

You have two problems here:

The K-S test is for a continuous distribution and so MYDATA should not contain any ties (repeated values).

The theory underlying the K-S test does not let you estimate the parameters of the distribution from the data as you have done. The help for ks.test explains this.