yeo_johnson: Yeo-Johnson transformation

View source: R/yeo_johnson.R

yeo_johnsonR Documentation

Yeo-Johnson transformation

Description

Perform Yeo-Johnson transformation to attempt normalization.

Usage

yeo_johnson(x, lambda = NULL, eps = 0.001)

Arguments

x

a numeric vector of values to make normal.

lambda

the value of the lambda parameter. When NULL, an appropriate value is estimated from the data.

eps

the tolerance value under which lamba is considered to be 0 and that is used to choose the appropriate formula.

Details

The Yeo-Johnson is similar to the Box-Cox method, however it allows for the transformation of non-positive data as well.

Value

A vector of transformed values, with an attribute to store the lambda value. The object if of class 'yeo_johnson' and can be used with predict.yeo_johnson().

References

Yeo, I. K., & Johnson, R. A. (2000). A new family of power transformations to improve normality or symmetry. Biometrika.

See Also

predict.yeo_johnson() to apply the same transformation to a new dataset.

Examples

# simulate non-normal data
x <- rgamma(100, 1, 1)
hist(x)
# and make it more normal looking
hist(yeo_johnson(x))

jiho/morphr documentation built on May 11, 2024, 9:32 p.m.