Kolmogorov smirnoff test for two samples: bug

Dave Goel deego3 at gmail.com
Thu Dec 4 15:54:05 CST 2008


Consider a=[1 2 3 4], and b=[5 6 7 8].

The null is a = b.  The alt. is !=.

We get 

octave:3> kolmogorov_smirnov_test_2 (a,b,"!=")
  pval: 0.0366311



Now consider an even more ridiculous null of a>b.  In this case, the
alt. is "<", So, p should get even lower. But, 
octave:5> kolmogorov_smirnov_test_2 (a,b,"<")
  pval: 1


Now, consider a very plausible null of a<b. The alt. is ">".  P should
now be about 1, but we get:

octave:6> kolmogorov_smirnov_test_2 (a,b,">")
  pval: 0.0183156


It seems that the meaning of < and > are flipped in the test.  Note
that the third argument refers to ALT, and not to NULL, as for
example, seen for the case of !=.



I have tested this with the latest octave as well. 


More information about the Bug-octave mailing list