Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signed version of the KS statistic #8

Closed
wants to merge 2 commits into from
Closed

Signed version of the KS statistic #8

wants to merge 2 commits into from

Conversation

ljosa
Copy link

@ljosa ljosa commented Mar 15, 2011

I have implemented a signed version of the KS statistic, with unit tests and documentation. Could you please merge into scipy:master?

Thanks,
Vebjorn

@josef-pkt
Copy link
Member

I think adding "signed" for the two-sided test will be misleading. The two-sided test shouldnt really be interpreted as a one sided test. It should be possible to add one-sided options similar to kstest, but I dont know what the distribution of the test statistic is or whether it is available in scipy.

both R and matlab http://www.mathworks.com/help/toolbox/stats/kstest2.html have the one-sided option

A trac ticket to keep track of this would be useful

@ljosa
Copy link
Author

ljosa commented Mar 22, 2011

@josef-pkt, I added it because I needed it to reimplement a method for cytological profiling (Perlman et al., Science 2004, doi:10.1126/science.1100709).

@rgommers
Copy link
Member

rgommers commented Apr 2, 2011

For the record, the method from that paper is described in the supporting online material. The one relevant sentence is:

We make repeated use in our analysis of a standard non-parametric method for comparing cdf’s, 
the Kolmogorov-Smirnov (KS) statistic (S2, 3) (Fig. S1). The function KS(f,g) computes f - g at 
the point where |f - g| reaches its maximum. Note that KS(f,g)= - KS(g,f)."

It seems they just made this up. The K-S test computes the distance between distribution functions, or a goodness-of-fit statistic. The test result should simply always be positive.

I think this can be closed. One-sided test would be useful, but that's unrelated to this patch.

@scopatz
Copy link
Member

scopatz commented Jul 25, 2011

This builds and tests on my system.

@pv
Copy link
Member

pv commented Nov 8, 2012

Ok, closing this. Reason: the signed statistic appears not to be a standard part of the K-S test (for instance R doesn't have it), and can be confused with the one-sided test (which has different critical values). However, the one-sided test could be added: http://projects.scipy.org/scipy/ticket/1771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants