scipy.special.nctdtridf#
- scipy.special.nctdtridf(p, nc, t, out=None) = <wrapped_ufunc 'nctdtridf'>#
Calculate degrees of freedom for non-central t distribution.
See
nctdtrfor more details.- Parameters:
- parray_like
CDF values, in range (0, 1].
- ncarray_like
Noncentrality parameter. Should be in range (-1e6, 1e6).
- tarray_like
Quantiles, i.e., the upper limit of integration.
- outndarray, optional
Optional output array for the function results
- Returns:
- dfscalar or ndarray
The degrees of freedom. If all inputs are scalar, the return will be a float. Otherwise, it will be an array.
See also
Notes
This function calculates the degrees of freedom of the non-central t distribution given a probability, quantile and non-centrality parameter using the Boost Math C++ library [1].
Array API Standard Support
nctdtridfhas 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.outis 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.outis never supported for JAX because JAX arrays are immutable.nctdtridfdoes not currently supportoutfor the PyTorch backend.See Array API coverage for more information.
References
[1]The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.
Examples
>>> from scipy.special import nctdtr, nctdtridf
Compute the CDF for several values of df:
>>> df = [1, 2, 3] >>> p = nctdtr(df, 0.25, 1) >>> p array([0.67491974, 0.716464 , 0.73349456])
Compute the inverse. We recover the values of df, as expected:
>>> nctdtridf(p, 0.25, 1) array([1., 2., 3.])