{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _continuous_distns / ksone_gen

class

scipy.stats._continuous_distns:ksone_gen

source: /scipy/stats/_continuous_distns.py :104

Signature

class   ksone_gen ( momtype = 1 a = None b = None xtol = 1e-14 badvalue = None name = None longname = None shapes = None seed = None )

Members

Summary

Kolmogorov-Smirnov one-sided test statistic distribution.

Extended Summary

This is the distribution of the one-sided Kolmogorov-Smirnov (KS) statistics and for a finite sample size n >= 1 (the shape parameter).

%(before_notes)s

Notes

and are given by

where is a continuous CDF and is an empirical CDF. ksone describes the distribution under the null hypothesis of the KS test that the empirical CDF corresponds to i.i.d. random variates with CDF .

%(after_notes)s

Examples

import numpy as np
from scipy.stats import ksone
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
Display the probability density function (``pdf``):
n = 1e+03
x = np.linspace(ksone.ppf(0.01, n),
                ksone.ppf(0.99, n), 100)
ax.plot(x, ksone.pdf(x, n),
        'r-', lw=5, alpha=0.6, label='ksone pdf')
Alternatively, the distribution object can be called (as a function) to fix the shape, location and scale parameters. This returns a "frozen" RV object holding the given parameters fixed. Freeze the distribution and display the frozen ``pdf``:
rv = ksone(n)
ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf')
ax.legend(loc='best', frameon=False)
plt.show()
fig-6084cb579c9217a7.png
Check accuracy of ``cdf`` and ``ppf``:
vals = ksone.ppf([0.001, 0.5, 0.999], n)
np.allclose([0.001, 0.5, 0.999], ksone.cdf(vals, n))

See also

kstest
kstwo
kstwobign

Aliases

  • scipy.stats._continuous_distns.ksone_gen