scipy.special.inv_boxcox#

scipy.special.inv_boxcox(y, lmbda, out=None) = <ufunc 'inv_boxcox'>#

Compute the inverse of the Box-Cox transformation.

Find \(x\) such that

\[\begin{split}y = \begin{cases} (x^\lambda - 1) / \lambda & \text{if } \lambda \neq 0 \\ \log(x) & \text{if } \lambda = 0 \end{cases}\end{split}\]
Parameters:
yarray_like

Transformed data (input to the inverse transform).

lmbdaarray_like

Power parameter \(\lambda\) of the Box-Cox transform.

outndarray, optional

Optional output array for the function values.

Returns:
xscalar or ndarray

Original data (inverse Box-Cox transform of y).

See also

boxcox

Box-Cox transformation.

inv_boxcox1p

Inverse of the Box-Cox transformation of 1 + x.

Notes

Added in version 0.16.0.

Array API Standard Support

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

See Support for the array API standard for more information.

Examples

>>> from scipy.special import boxcox, inv_boxcox
>>> y = boxcox([1, 4, 10], 2.5)
>>> inv_boxcox(y, 2.5)
array([1., 4., 10.])