I am hoping some more enlightened statistician can help me to understand two constants used in the source of the scipy implementation of k-s 2 sample test.
I already sent an e-mail to the dev group, but I'm not sure I'll get a reply.
A pointer to the source is here: https://github.com/scipy/scipy/blob/master/scipy/stats/stats.py#L4756
Why it's strange is that it's a call to a function returning the p-value, where two constants (0.12, 0.11) are used for no apparent reason.
Here's the entirety of the function:
data1 = np.sort(data1) data2 = np.sort(data2) n1 = data1.shape n2 = data2.shape data_all = np.concatenate([data1, data2]) cdf1 = np.searchsorted(data1, data_all, side='right') / (1.0*n1) cdf2 = np.searchsorted(data2, data_all, side='right') / (1.0*n2) d = np.max(np.absolute(cdf1 - cdf2)) # Note: d absolute not signed distance en = np.sqrt(n1 * n2 / float(n1 + n2)) try: prob = distributions.kstwobign.sf((en + 0.12 + 0.11 / en) * d) except: prob = 1.0 return Ks_2sampResult(d, prob)