Applies the Box-Cox transformation to normalize the data distribution. It automatically handles non-positive values by shifting the data. The optimal lambda parameter is estimated using Maximum Likelihood Estimation (MLE).
trans_boxcox(x, lambda = "auto", force_pos = TRUE)A numeric vector with the transformed values.
The used lambda and shift amount are attached as attributes:
attr(res, "lambda") and attr(res, "shift").
A numeric vector.
A numeric value for the transformation power.
If "auto" (default), the optimal lambda is estimated within the interval [-2, 2].
Logical. If TRUE (default), automatically shifts data to be positive
if non-positive values are present.
Box, G. E. P., & Cox, D. R. (1964). An analysis of transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26(2), 211-243. https://www.jstor.org/stable/2984418