KSone Distribution

This is the distribution of maximum positive differences between an empirical distribution function, computed from \(n\) samples or observations, and a comparison (or target) cumulative distribution function.

Writing \(D_n^+ = \sup_t \left(F_{empirical,n}(t)-F_{target}(t)\right)\), ksone is the distribution of the \(D_n^+\) values. (The distribution of \(D_n^- = \sup_t \left(F_{target}(t)-F_{empirical,n}(t)\right)\) differences follows the same distribution, so ksone can be used for one-sided tests on either side.)

There is one shape parameter \(n\), a positive integer, and the support is \(x\in\left[0,1\right]\).

\begin{eqnarray*} F\left(n, x\right) & = & 1 - \sum_{j=0}^{\lfloor n(1-x)\rfloor} \dbinom{n}{j} x \left(x+\frac{j}{n}\right)^{j-1} \left(1-x-\frac{j}{n}\right)^{n-j}\\ & = & 1 - \textrm{scipy.special.smirnov}(n, x) \\ \lim_{n \rightarrow\infty} F\left(n, \frac{x}{\sqrt n}\right) & = & e^{-2 x^2} \end{eqnarray*}

References

Implementation: scipy.stats.ksone