Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bct

Box-Cox Transforms


Description

Computes the Box-Cox transform of the data for a given value of lambda. Includes the scaling factor.

Usage

bct(y, lambda)

Arguments

y

Vector of data to be transformed.

lambda

Scalar exponent for transform (1 is linear, 0 is log).

Details

bct computes the Box-Cox family of transforms: y = (y\^lambda - 1)/(lambda*gm\^(lambda-1)), where gm is the geometric mean of the y's. returns log(y)*gm when lambda equals 0.

Value

A vector of the same length as y with the corresponding transformed values.

Author(s)

See Also

vis.boxcox, vis.boxcoxu, boxcox in package MASS, other implementations in various packages

Examples

y <- rlnorm(500, 3, 2)
par(mfrow=c(2,2))
qqnorm(y)
qqnorm(bct(y,1/2))
qqnorm(bct(y,0))
hist(bct(y,0))

TeachingDemos

Demonstrations for Teaching and Learning

v2.12
Artistic-2.0
Authors
Greg Snow
Initial release
2020-04-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.