bestNormalize (version 0.2.2)

yeojohnson: Yeo-Johnson Normalization

Description

Perform a Yeo-Johnson Transformation and center/scale a vector to attempt normalization

Usage

yeojohnson(x, eps = 0.001, ...)

# S3 method for yeojohnson predict(object, newdata = NULL, inverse = FALSE, ...)

# S3 method for yeojohnson print(x, ...)

Arguments

x

A vector to normalize with Yeo-Johnson

eps

A value to compare lambda against to see if it is equal to zero

...

Additional arguments that can be passed to the estimation of the lambda parameter (lower, upper)

object

an object of class 'yeojohnson'

newdata

a vector of data to be (reverse) transformed

inverse

if TRUE, performs reverse transformation

Value

A list of class yeojohnson with elements

x.t

transformed original data

x

original data

mean

mean of vector post-YJ transformation

sd

sd of vector post-BC transformation

lambda

estimated lambda value for skew transformation

n

number of nonmissing observations

norm_stat

Pearson's P / degrees of freedom

The predict function returns the numeric value of the transformation performed on new data, and allows for the inverse transformation as well.

Details

yeojohnson estimates the optimal value of lamda for the Yeo-Johnson transformation. This transformation can be performed on new data, and inverted, via the predict function.

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

References

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

Max Kuhn and Hadley Wickham (2017). recipes: Preprocessing Tools to Create Design Matrices. R package version 0.1.0.9000. https://github.com/topepo/recipes

See Also

step_YeoJohnson

Examples

Run this code
# NOT RUN {
x <- rgamma(100, 1, 1)

yeojohnson_obj <- yeojohnson(x)
yeojohnson_obj
p <- predict(yeojohnson_obj)
x2 <- predict(yeojohnson_obj, newdata = p, inverse = TRUE)

all.equal(x2, x)

# }

Run the code above in your browser using DataLab