File: continuous_ksone.rst

package info (click to toggle)
scipy 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 132,464 kB
  • sloc: python: 207,830; ansic: 92,105; fortran: 76,906; cpp: 68,145; javascript: 32,742; makefile: 422; pascal: 421; sh: 158
file content (38 lines) | stat: -rwxr-xr-x 1,392 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

.. _continuous-ksone:

KSone Distribution
==================


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

Writing :math:`D_n^+ = \sup_t \left(F_{empirical,n}(t)-F_{target}(t)\right)`,
``ksone`` is the distribution of the :math:`D_n^+` values.
(The distribution of :math:`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 :math:`n`, a positive integer, and the support is :math:`x\in\left[0,1\right]`.

.. math::
   :nowrap:

    \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
----------

-  "Kolmogorov-Smirnov test", Wikipedia
   https://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test

-  Birnbaum, Z. W.; Tingey, Fred H. "One-Sided Confidence Contours for Probability Distribution Functions."
   *Ann. Math. Statist*. 22 (1951), no. 4, 592--596.


Implementation: `scipy.stats.ksone`