scipy.special.boxcox#

scipy.special.boxcox(x, lmbda) = <ufunc 'boxcox'>#

Compute the Box-Cox transformation.

The Box-Cox transformation is:

y = (x**lmbda - 1) / lmbda  if lmbda != 0
    log(x)                  if lmbda == 0

Returns nan if x < 0. Returns -inf if x == 0 and lmbda < 0.

Parameters
xarray_like

Data to be transformed.

lmbdaarray_like

Power parameter of the Box-Cox transform.

Returns
yarray

Transformed data.

Notes

New in version 0.14.0.

Examples

>>> from scipy.special import boxcox
>>> boxcox([1, 4, 10], 2.5)
array([   0.        ,   12.4       ,  126.09110641])
>>> boxcox(2, [0, 1, 2])
array([ 0.69314718,  1.        ,  1.5       ])