scipy.special.chdtrc#

scipy.special.chdtrc(v, x, out=None) = <ufunc 'chdtrc'>#

Chi square survival function.

Returns the area under the right hand tail (from x to infinity) of the Chi square probability density function with v degrees of freedom:

\[\frac{1}{2^{v/2} \Gamma(v/2)} \int_x^\infty t^{v/2 - 1} e^{-t/2} dt\]

Here \(\Gamma\) is the Gamma function; see gamma. This integral can be expressed in terms of the regularized upper incomplete gamma function gammaincc as gammaincc(v / 2, x / 2). [1]

Parameters:
varray_like

Degrees of freedom.

xarray_like

Lower bound of the integral.

outndarray, optional

Optional output array for the function results.

Returns:
scalar or ndarray

Values of the survival function.

Notes

Array API Standard Support

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

See Support for the array API standard for more information.

References

Examples

>>> import numpy as np
>>> import scipy.special as sc

It can be expressed in terms of the regularized upper incomplete gamma function.

>>> v = 1
>>> x = np.arange(4)
>>> sc.chdtrc(v, x)
array([1.        , 0.31731051, 0.15729921, 0.08326452])
>>> sc.gammaincc(v / 2, x / 2)
array([1.        , 0.31731051, 0.15729921, 0.08326452])