This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / stats / _continuous_distns / ksone_gen

class

scipy.stats._continuous_distns:ksone_gen

source: build-install/usr/lib/python3.14/site-packages/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')
✗
[<matplotlib.lines.Line2D object at 0x7f3f60b82660>]
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)
✗
<matplotlib.legend.Legend object at 0x7f3f60b830e0>
plt.show()
✓
fig-0c4774b8a0baf4ce.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))
✓
True

See also

kstest
kstwo
kstwobign

Aliases

  • scipy.stats._continuous_distns.ksone_gen