Skip to contents

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().

Value

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

Details

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

Examples

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