Generalized Box-Cox transformation.
powTrans(x, lambda = 0, alpha = 0, normalize = FALSE, jacobian = FALSE)
x | Vector of quantiles at which to compute the transformation. |
---|---|
lambda | Exponent of the transformation. See Details. |
alpha | Offset of the transformation. See Details. |
normalize | Logical; if |
jacobian | Logical; if |
The vector z
of transformed values, and optionally the Jacobian of the inverse transformation. See Details.
The Generalized Power or Box-Cox transformation is $$ z = \begin{array}{rl} ((x + \alpha)^\lambda - 1) / (\lambda C^{\lambda-1}) & \lambda \neq 0 \\ C \log(x + \alpha) & \lambda = 0, \end{array} $$
where \(C\) is the Geometric mean, i.e., C = exp(mean(log(x + alpha)))
. Note that C
is only calculated if normalize = TRUE
.