bxcx(FitAR)R Documentation

Box-Cox transformation and its inverse

Description

Box-Cox or power transformation or its inverse. For lambda!=0, the Box-Cox transformation is of x is (x-1)^lambda/lambda whereas the regular power transformation is simply x^lambda. When lambda=0, it is log in both cases. The inverse of the Box-Cox and the power transform can also be obtained.

Usage

bxcx(x, lambda, InverseQ = FALSE, type = "BoxCox")

Arguments

x a vector or time series
lambda power transformation parameter
InverseQ if TRUE, the inverse transformation is done
type either "BoxCox" or "power"

Details

A small positive constant is added to all the data if any data value is zero or negative.

Value

a vector or tsime series of the transformed data

Author(s)

A.I. McLeod

References

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. Journal of Royal Statistical Society, Series B, vol. 26, pp. 211-246.

See Also

BoxCox

Examples

#lambda=0.5
z<-AirPassengers; lambda<-0.5
y<-bxcx(z, lambda)
z2<-bxcx(y, lambda, InverseQ=TRUE)
sum(abs(z2-z))
#
z<-AirPassengers; lambda<-0.0
y<-bxcx(z, lambda)
z2<-bxcx(y, lambda, InverseQ=TRUE)
sum(abs(z2-z))

[Package FitAR version 1.0 Index]