bundles / scipy latest / scipy / stats / _continuous_distns / kstwo_gen
class
scipy.stats._continuous_distns:kstwo_gen
Signature
class kstwo_gen ( momtype = 1 , a = None , b = None , xtol = 1e-14 , badvalue = None , name = None , longname = None , shapes = None , seed = None ) Members
Summary
Kolmogorov-Smirnov two-sided test statistic distribution.
Extended Summary
This is the distribution of the two-sided Kolmogorov-Smirnov (KS) statistic for a finite sample size n >= 1 (the shape parameter).
%(before_notes)s
Notes
is given by
where is a (continuous) CDF and is an empirical CDF. kstwo 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 kstwo import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1)✓
n = 10 x = np.linspace(kstwo.ppf(0.01, n), kstwo.ppf(0.99, n), 100)✓
ax.plot(x, kstwo.pdf(x, n), 'r-', lw=5, alpha=0.6, label='kstwo pdf')✗
rv = kstwo(n)
✓ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf') ax.legend(loc='best', frameon=False)✗
plt.show()
✓
vals = kstwo.ppf([0.001, 0.5, 0.999], n) np.allclose([0.001, 0.5, 0.999], kstwo.cdf(vals, n))✓
See also
- ksone
- kstest
- kstwobign
Aliases
-
scipy.stats._continuous_distns.kstwo_gen