scipy.special.ncfdtridfn#

scipy.special.ncfdtridfn(p, dfd, nc, f, out=None) = <wrapped_ufunc 'ncfdtridfn'>#

Calculate degrees of freedom (numerator) for the noncentral F-distribution.

This is the inverse with respect to dfn of ncfdtr. See ncfdtr for more details.

Parameters:
parray_like

Value of the cumulative distribution function. Must be in the range [0, 1].

dfdarray_like

Degrees of freedom of the denominator sum of squares. Range (0, inf).

ncarray_like

Noncentrality parameter. Should be in range (0, 1e4).

ffloat

Quantiles, i.e., the upper limit of integration.

outndarray, optional

Optional output array for the function results

Returns:
dfnscalar or ndarray

Degrees of freedom of the numerator sum of squares.

See also

ncfdtr

CDF of the non-central F distribution.

ncfdtri

Quantile function; inverse of ncfdtr with respect to f.

ncfdtridfd

Inverse of ncfdtr with respect to dfd.

ncfdtrinc

Inverse of ncfdtr with respect to nc.

Notes

The value of the cumulative noncentral F distribution is not necessarily monotone in either degrees of freedom. There thus may be two values that provide a given CDF value. This routine assumes monotonicity and will find an arbitrary one of the two values.

Array API Standard Support

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

See Support for the array API standard for more information.

Examples

>>> from scipy.special import ncfdtr, ncfdtridfn

Compute the CDF for several values of dfn:

>>> dfn = [1, 2, 3]
>>> p = ncfdtr(dfn, 2, 0.25, 15)
>>> p
array([ 0.92562363,  0.93020416,  0.93188394])

Compute the inverse. We recover the values of dfn, as expected:

>>> ncfdtridfn(p, 2, 0.25, 15)
array([ 1.,  2.,  3.])