scipy.special.chndtridf#

scipy.special.chndtridf(x, p, nc, out=None) = <ufunc 'chndtridf'>#

Inverse to chndtr vs df

Calculated using a search to find a value for df that produces the desired value of p.

Parameters:
xarray_like

Upper bound of the integral; must satisfy x >= 0

parray_like

Probability; must satisfy 0 <= p < 1

ncarray_like

Non-centrality parameter; must satisfy nc >= 0

outndarray, optional

Optional output array for the function results

Returns:
dfscalar or ndarray

Degrees of freedom

See also

chndtr

Noncentral chi-squared distribution CDF

chndtrix

inverse of chndtr with respect to x

chndtrinc

inverse of chndtr with respect to nc

scipy.stats.ncx2

Non-central chi-squared distribution

Notes

The noncentral chi squared distribution is also available in scipy.stats.ncx2.

This function wraps routines from the Boost Math C++ library [1].

References

[1]

The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.

Examples

>>> from scipy.special import chndtridf, chndtr

Compute the noncentral chi squared distribution CDF at one point.

>>> x, df, nc = 3, 5, 10
>>> p = chndtr(x, df, nc)

chndtridf is the inverse of chndtr with respect to df:

>>> chndtridf(x, p, nc)
5.0