box.cox

0th

Percentile

Box-Cox Family of Transformations

Compute the Box-Cox power transformation of a variable.

Keywords
manip, regression
Usage
box.cox(x, p, start=0)

bc(x, p)
Arguments
x
numeric vector to transform.
p
power (0 = log).
start
constant to be added to each value of x prior to transformation.
Details

Computes $x^{\prime }=(x^p-1)/p$ for $p \neq 0$ and $x^{\prime }=\log x$ for $p=0$. The values of x must all be positive; if not, a start should be added to each value to make all the values positive. The function will automatically compute the start and print a warning, if necessary. bc is just an abbreviation for box.cox.

Value

  • a vector of transformed values.

Warning

These functions do not compute the maximum-likelihood estimate for a Box-Cox normalizing transformation. See box.cox.powers for estimating unconditional univariate and multivariate Box-Cox transformations, and boxcox in the MASS package for estimating the Box-Cox transformation of the response in a linear model.

References

Atkinson, A. C. (1985) Plots, Transformations, and Regression Oxford. Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26 211--246. Fox, J. (1997) Applied Regression, Linear Models, and Related Methods. Sage.

See Also

boxcox, box.cox.var, box.cox.powers, box.cox.axis

Aliases
  • box.cox
  • bc
Examples
box.cox(1:10, 2)
## [1]  0.0  1.5  4.0  7.5 12.0 17.5 24.0 31.5 40.0 49.5
box.cox(-5:5, 2)
##  [1]  0.0  1.5  4.0  7.5 12.0 17.5 24.0 31.5 40.0 49.5 60.0
## Warning message: 
## start =  6 added to data prior to transformation in: box.cox(-5:5, 2)
options(digits=4)
box.cox(-5:5, 0, start=6)
##  [1] 0.0000 0.6931 1.0986 1.3863 1.6094 1.7918 1.9459 2.0794 2.1972
## [10] 2.3026 2.3979
Documentation reproduced from package car, version 0.8-3, License: GPL version 2 or newer

Community examples

Looks like there are no examples yet.