Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

yj_trans

Yeo-Johnson transformation


Description

The Yeo-Johnson transformation is a flexible transformation that is similiar to Box-Cox, boxcox_trans(), but does not require input values to be greater than zero.

Usage

yj_trans(p)

Arguments

p

Transformation exponent, λ.

Details

The transformation takes one of four forms depending on the values of y and λ.

  • y ≥ 0 and λ != 0 : y^(λ) = ((y + 1)^λ - 1)/λ

  • y ≥ 0 and λ = 0: y^(λ) = ln(y + 1)

  • y < 0 and λ != 2: y^(λ) = -((-y + 1)^(2 - λ) - 1)/(2 - λ)

  • y < 0 and λ = 2: y^(λ) = -ln(-y + 1)

References

Yeo, I., & Johnson, R. (2000). A New Family of Power Transformations to Improve Normality or Symmetry. Biometrika, 87(4), 954-959. http://www.jstor.org/stable/2673623

Examples

plot(yj_trans(-1), xlim = c(-10, 10))
plot(yj_trans(0), xlim = c(-10, 10))
plot(yj_trans(1), xlim = c(-10, 10))
plot(yj_trans(2), xlim = c(-10, 10))

scales

Scale Functions for Visualization

v1.1.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Dana Seidel [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.