BoxCox: Box Cox Transformation

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

BoxCox() returns a transformation of the input variable using a Box-Cox transformation.
BoxCoxInv() reverses the transformation.

Usage

1
2
BoxCox(x, lambda)
BoxCoxInv(x, lambda)

Arguments

x

a numeric vector

lambda

transformation parameter

Details

The Box-Cox transformation is given by

f(x;λ)=(x^λ - 1)/λ, if λ not 0, log(x), otherwise

Value

a numeric vector of the same length as x.

Note

These two functions are borrowed from library(forecast).

Author(s)

Rob J Hyndman <rob.hyndman@monash.edu>

References

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211–246.

See Also

Use BoxCoxLambda or boxcox in library(MASS) to find optimal lambda values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# example by Greg Snow
x <- rlnorm(500, 3, 2)

par(mfrow=c(2,2))
qqnorm(x, main="Lognormal")
qqnorm(BoxCox(x, 1/2), main="BoxCox(lambda=0.5)")
qqnorm(BoxCox(x, 0), main="BoxCox(lambda=0)")

PlotFdist(BoxCox(x, 0))

bx <- BoxCox(x, lambda = BoxCoxLambda(x) )

AndriSignorell/DescTools documentation built on April 8, 2021, 5:51 a.m.