scipy.special.gdtrix#

scipy.special.gdtrix(a, b, p, out=None) = <wrapped_ufunc 'gdtrix'>#

Inverse of gdtr vs x.

Returns the inverse with respect to the parameter x of p = gdtr(a, b, x), the cumulative distribution function of the gamma distribution. This is also known as the pth quantile of the distribution.

Parameters:
aarray_like

a parameter values of gdtr(a, b, x). 1/a is the “scale” parameter of the gamma distribution.

barray_like

b parameter values of gdtr(a, b, x). b is the “shape” parameter of the gamma distribution.

parray_like

Probability values.

outndarray, optional

If a fourth argument is given, it must be a numpy.ndarray whose size matches the broadcast result of a, b and p. out is then the array returned by the function.

Returns:
xscalar or ndarray

Values of the x parameter such that p = gdtr(a, b, x).

See also

gdtr

CDF of the gamma distribution.

gdtria

Inverse with respect to a of gdtr(a, b, x).

gdtrib

Inverse with respect to b of gdtr(a, b, x).

gammaincinv

Inverse of the incomplete regularized gamma function.

Notes

gdtrix is implemented in terms of the incomplete gamma inverse as gdtrix(a, b, p) = gammaincinv(b, p)/a.

Array API Standard Support

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

See Array API coverage for more information.

Examples

First evaluate gdtr.

>>> from scipy.special import gdtr, gdtrix
>>> p = gdtr(1.2, 3.4, 5.6)
>>> print(p)
0.94378087442

Verify the inverse.

>>> gdtrix(1.2, 3.4, p)
5.6