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.
New in version 0.14.0.
Parameters: | x : array_like
lmbda : array_like
|
---|---|
Returns: | y : array
|
Examples
>>> boxcox([1, 4, 10], 2.5)
array([ 0. , 12.4 , 126.09110641])
>>> boxcox(2, [0, 1, 2])
array([ 0.69314718, 1. , 1.5 ])