boxcox_tr {lidaRtRee}R Documentation

Box-Cox Transformation

Description

Box-Cox Transformation

Usage

boxcox_tr(x, lambda)

Arguments

x

vector or raster. values to be transformed

lambda

numeric. parameter of Box-Cox transformation

Value

a vector or raster of transformed values

See Also

boxcox_itr inverse Box-Cox transformation, boxcox_itr_bias_cor inverse Box-Cox transformation with bias correction.

Examples

x <- 1:10
boxcox_tr(x, -2)
boxcox_tr(x, 0)
boxcox_tr(x, 0.5)
boxcox_tr(x, 2)

# plot functions
curve(boxcox_tr(x, 1.5), 1, 5,
  main = "Box Cox transform", xlab = "x",
  ylab = "Boxcox(x, lambda)", col = "red"
)
curve(boxcox_tr(x, -2), 1, 5, col = "green", add = TRUE)
curve(boxcox_tr(x, 0), 1, 5, col = "blue", add = TRUE)
curve(boxcox_tr(x, 0.5), 1, 5, col = "black", add = TRUE)
curve(boxcox_tr(x, 1), 1, 5, col = "pink", add = TRUE)
legend("topleft",
  legend = rev(c(-2, 0, 0.5, 1, 1.5, "lambda")),
  col = rev(c("green", "blue", "black", "pink", "red", NA)), lty = 1
)

[Package lidaRtRee version 4.0.5 Index]