# bcPower

0th

Percentile

##### Box-Cox and Yeo-Johnson Power Transformations

Transform the elements of a vector using, the Box-Cox, Yeo-Johnson, or simple power transformations.

Keywords
regression
##### Usage
bcPower(U, lambda, jacobian.adjusted = FALSE)

basicPower(U,lambda)
##### Arguments
U
A vector, matrix or data.frame of values to be transformed
lambda
The one-dimensional transformation parameter, usually in the range from $-2$ to $2$, or if U is a matrix or data frame, a vector of length ncol(U) of transformation parameters
If TRUE, the transformation is normalized to have Jacobian equal to one. The default is FALSE.
##### Details

The Box-Cox family of scaled power transformations equals $(U^{\lambda}-1)/\lambda$ for $\lambda \neq 0$, and $\log(U)$ if $\lambda =0$. If family="yeo.johnson" then the Yeo-Johnson transformations are used. This is the Box-Cox transformation of $U+1$ for nonnegative values, and of $|U|+1$ with parameter $2-\lambda$ for $U$ negative. If jacobian.adjusted is TRUE, then the scaled transformations are divided by the Jacobian, which is a function of the geometric mean of $U$. The basic power transformation returns $U^{\lambda}$ if $\lambda$ is not zero, and $\log(\lambda)$ otherwise. Missing values are permitted, and return NA where ever Uis equal to NA.

##### Value

• Returns a vector or matrix of transformed values.

##### References

Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage. Weisberg, S. (2014) Applied Linear Regression, Fourth Edition, Wiley Wiley, Chapter 7. Yeo, In-Kwon and Johnson, Richard (2000) A new family of power transformations to improve normality or symmetry. Biometrika, 87, 954-959.

powerTransform

• bcPower
• yjPower
• basicPower
##### Examples
U <- c(NA, (-3:3))
bcPower(U, 0)  # produces an error as U has negative values
bcPower(U+4,0)
#basicPower(V, c(0,1))