# Re: Finding Outliers in kolmogorov Smirnov Test

Home 21090308 Forums Re: Finding Outliers in kolmogorov Smirnov Test

#2074
Ryu
Member

Hi,

I believe the results you got, i.e.,

(Different Results: D= 0.0692 with a corresponding Prob= 1.000)

, is wrong.

I did the same in R and got the following.

R code:

x= c(0.000601  ,0.008060  , 0.278458  ,0.265639  ,0.265801  ,0.271759  ,0.025475  ,0.024874  ,0.030063  ,0.272768  ,0.269187  ,0.269335  ,0.275432  ,0.007426  ,0.275711  ,0.010635  ,0.010385  ,0.008468  ,0.276103  ,0.023252  ,0.279603  ,0.278323  ,0.008338  ,0.284672  ,0.017762  ,0.284290  ,0.010843  ,0.288691  ,0.274291  ,0.274425  ,0.280645  ,0.015278  ,0.280250  ,0.007913  ,0.284656  ,0.004040  ,0.273945  ,0.274108  ,0.280049  ,0.008338  ,0.281106  ,0.008768  ,0.284414  ,0.014078  ,0.013539)
y = c(0.011337  ,0.010747  ,0.017399  ,0.266760  ,0.014397  ,0.270030  ,0.013395  ,0.278917  ,0.274877  ,0.275089  ,0.293534)
ks.test(x, y, alternative = “two.sided”)

R result:

Two-sample Kolmogorov-Smirnov test

data:  x and y
D = 0.2444, p-value = 0.6664
alternative hypothesis: two-sided

Warning message:
In ks.test(x, y, alternative = “two.sided”) :
cannot compute correct p-values with ties

SuanShu agrees with R.

Please note that SuanShu is more accurate than R. As stated in R’s help page,

Exact p-values are not available for the one-sided two-sample case, or in the case of ties.

.

In contrast, SuanShu computes the exact distribution according to this paper:
“Algorithm AS 288: Exact Smirnov Two-Sample Tests for Arbitrary Distributions. Andrei M. Nikiforov, 1994. Royal Statistical Society.”

So, I would recommend to trust SuanShu’s results over other software.

Hope this helps.