scipy.special.stdtridf#

scipy.special.stdtridf(p, t, out=None) = <wrapped_ufunc 'stdtridf'>#

Inverse of stdtr vs df.

Returns the argument df such that stdtr(df, t) is equal to p.

Parameters:
parray_like

Probability

tarray_like

Upper bound of the integral

outndarray, optional

Optional output array for the function results

Returns:
dfscalar or ndarray

Value of df such that stdtr(df, t) == p

See also

stdtr

Student t CDF

stdtrit

inverse of stdtr with respect to t

scipy.stats.t

Student t distribution

Notes

Array API Standard Support

stdtridf 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. stdtridf does not currently support out for the PyTorch backend.

See Array API coverage for more information.

Examples

Compute the student t cumulative distribution function for one parameter set.

>>> from scipy.special import stdtr, stdtridf
>>> df, x = 5, 2
>>> cdf_value = stdtr(df, x)
>>> cdf_value
0.9490302605850709

Verify that stdtridf recovers the original value for df given the CDF value and x.

>>> stdtridf(cdf_value, x)
5.000000000000012