Is kolmogorov_smirnov_test_2 buggy?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is kolmogorov_smirnov_test_2 buggy?

2j4CG6F0gH
Hi,

The following shows that octave and R returns different results for
K-S test. I think that the result from R is correct. Does anybody know
why kolmogorov_smirnov_test_2 is different? Or I call it incorrectly?

octave:1> kolmogorov_smirnov_test_2([1 2 3 4 5], [11 12 13 14 15])
  pval: 0.0134759
ans =  0.013476


From R

> ks.test(1:5, 11:15)

        Two-sample Kolmogorov-Smirnov test

data:  1:5 and 11:15
D = 1, p-value = 0.007937
alternative hypothesis: two-sided



--
Regards,
Peng
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Is kolmogorov_smirnov_test_2 buggy?

Juan Pablo Carbajal-2
On Fri, Nov 2, 2012 at 1:42 AM, Peng Yu <[hidden email]> wrote:

> Hi,
>
> The following shows that octave and R returns different results for
> K-S test. I think that the result from R is correct. Does anybody know
> why kolmogorov_smirnov_test_2 is different? Or I call it incorrectly?
>
> octave:1> kolmogorov_smirnov_test_2([1 2 3 4 5], [11 12 13 14 15])
>   pval: 0.0134759
> ans =  0.013476
>
>
> From R
>
>> ks.test(1:5, 11:15)
>
>         Two-sample Kolmogorov-Smirnov test
>
> data:  1:5 and 11:15
> D = 1, p-value = 0.007937
> alternative hypothesis: two-sided
>
>
>
> --
> Regards,
> Peng
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave

It is hard to say and I can't find any situation when the conclusion
in Octave is wrong.

Could you please check the formulas in this paper (freely available)?

http://www.jstatsoft.org/v08/i18/

These are the ones used for the two-sided test in R. Maybe the Octave
version is using the approximation that R is not using. Can't say!

Just in case I added the mail of the author to this discussion.

Cheers
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Is kolmogorov_smirnov_test_2 buggy?

Muhali
In reply to this post by 2j4CG6F0gH
> From R
>
> > ks.test(1:5, 11:15)
>
>         Two-sample Kolmogorov-Smirnov test
>
> data:  1:5 and 11:15
> D = 1, p-value = 0.007937
> alternative hypothesis: two-sided

if you don't use the exact method you get the same result

ks.test(1:5, 11:15, exact = FALSE)

        Two-sample Kolmogorov-Smirnov test

data:  1:5 and 11:15
D = 1, p-value = 0.01348
alternative hypothesis: two-sided

See e.g. http://www.jstatsoft.org/v39/i11

M.