scipy.special.smirnovi#

scipy.special.smirnovi(n, p, out=None) = <wrapped_ufunc 'smirnovi'>#

Inverse to smirnov.

Returns d such that smirnov(n, d) == p, the critical value corresponding to p.

Parameters:
nint

Number of samples

pfloat array_like

Probability

outndarray, optional

Optional output array for the function results

Returns:
scalar or ndarray

The value(s) of smirnovi(n, p), the critical values.

See also

smirnov

The Survival Function (SF) for the distribution

scipy.stats.ksone

Provides the functionality as a continuous distribution

kolmogorov, kolmogi

Functions for the two-sided distribution

scipy.stats.kstwobign

Two-sided Kolmogorov-Smirnov distribution, large n

Notes

For historical reasons this function is exposed in scipy.special, but the recommended way to achieve the most accurate CDF/SF/PDF/PPF/ISF computations is to use the scipy.stats.ksone distribution.

Array API Standard Support

smirnovi has support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

✅

n/a

CuPy

n/a

⛔

PyTorch

✅

⛔

JAX

✅

⛔

Dask

✅

n/a

For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support out, but typically none of the other ufunc kwargs. out is typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend. out is never supported for JAX because JAX arrays are immutable. smirnovi does not currently support out for the PyTorch backend.

See Support for the array API standard for more information.

Examples

>>> from scipy.special import smirnovi, smirnov
>>> n = 24
>>> deviations = [0.1, 0.2, 0.3]

Use smirnov to compute the complementary CDF of the Smirnov distribution for the given number of samples and deviations.

>>> p = smirnov(n, deviations)
>>> p
array([0.58105083, 0.12826832, 0.01032231])

The inverse function smirnovi(n, p) returns deviations.

>>> smirnovi(n, p)
array([0.1, 0.2, 0.3])