boxcox: Box Cox transformation

View source: R/treat.R

boxcoxR Documentation

Box Cox transformation

Description

Simple Box Cox, with no optimisation of lambda.

Usage

boxcox(x, lambda, makepos = TRUE, na.rm = FALSE)

Arguments

x

A vector or column of data to transform

lambda

The lambda parameter of the Box Cox transform

makepos

If TRUE (default) makes all values positive by subtracting the minimum and adding 1.

na.rm

If TRUE, NAs will be removed: only relevant if makepos = TRUE which invokes min().

Details

This function replaces the now-defunct BoxCox() from COINr < v1.0.

Value

A vector of length length(x) with transformed values.

Examples

# example data
x <- runif(30)
# Apply Box Cox
xBox <- boxcox(x, lambda = 2)
# plot one against the other
plot(x, xBox)


COINr documentation built on Oct. 9, 2023, 5:07 p.m.