BoxCox | R Documentation |
BoxCox() returns a transformation of the input variable using a Box-Cox transformation. InvBoxCox() reverses the transformation.
BoxCox(x, lambda)
InvBoxCox(x, lambda, biasadj = FALSE, fvar = NULL)
x |
a numeric vector or time series of class |
lambda |
transformation parameter. If |
biasadj |
Use adjusted back-transformed mean for Box-Cox transformations. If transformed data is used to produce forecasts and fitted values, a regular back transformation will result in median forecasts. If biasadj is TRUE, an adjustment will be made to produce mean forecasts and fitted values. |
fvar |
Optional parameter required if biasadj=TRUE. Can either be the
forecast variance, or a list containing the interval |
The Box-Cox transformation (as given by Bickel & Doksum 1981) is given by
f_\lambda(x) =(sign(x)|x|^\lambda -
1)/\lambda
if \lambda\ne0
. For \lambda=0
,
f_0(x)=\log(x)
.
a numeric vector of the same length as x.
Rob J Hyndman & Mitchell O'Hara-Wild
Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211–246. Bickel, P. J. and Doksum K. A. (1981) An Analysis of Transformations Revisited. JASA 76 296-311.
BoxCox.lambda
lambda <- BoxCox.lambda(lynx)
lynx.fit <- ar(BoxCox(lynx,lambda))
plot(forecast(lynx.fit,h=20,lambda=lambda))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.