powered by
BoxCox() returns a transformation of the input variable using a Box-Cox transformation. InvBoxCox() reverses the transformation.
BoxCox()
InvBoxCox()
BoxCox(x, lambda)InvBoxCox(x, lambda)
InvBoxCox(x, lambda)
a numeric vector.
a numeric value for the transformation parameter.
a transformed numeric vector of the same length as x.
The Box-Cox transformation is given by $$f_\lambda(x) =\frac{x^\lambda - 1}{\lambda}$$ if \(\lambda\ne0\). For \(\lambda=0\), $$f_0(x)=\log(x)$$.
Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211--246.
# NOT RUN { library(tsibble) airmiles %>% as_tsibble() %>% mutate(BoxCox = BoxCox(value, lambda = 0.3)) # }
Run the code above in your browser using DataLab