yeo.johnson {VGAM} | R Documentation |
Computes the Yeo-Johnson transformation, which is a normalizing transformation.
yeo.johnson(y, lambda, derivative = 0, epsilon = sqrt(.Machine$double.eps), inverse = FALSE)
y |
Numeric, a vector or matrix. |
lambda |
Numeric. It is recycled to the same length as
y if necessary. |
derivative |
Non-negative integer. The default is
the ordinary function evaluation, otherwise the derivative
with respect to lambda . |
epsilon |
Numeric and positive value. The tolerance given
to values of lambda when comparing it to 0 or 2. |
inverse |
Logical. Return the inverse transformation? |
The Yeo-Johnson transformation can be thought of as an extension of the Box-Cox transformation. It handles both positive and negative values, whereas the Box-Cox transformation only handles positive values. Both can be used to transform the data so as to improve normality. They can be used to perform LMS quantile regression.
The Yeo-Johnson transformation or its inverse, or its
derivatives with respect to lambda
, of y
.
If inverse=TRUE
then the argument derivative=0
is required.
Thomas W. Yee
Yeo, I.-K. and Johnson, R. A. (2000) A new family of power transformations to improve normality or symmetry. Biometrika, 87, 954–959.
Yee, T. W. (2004) Quantile regression via vector generalized additive models. Statistics in Medicine, 23, 2295–2315.
n = 200 y = seq(-4, 4, len=n) ltry = c(0, 0.5, 1, 1.5, 2) # Try these values of lambda lltry = length(ltry) psi = matrix(NA, n, lltry) for(i in 1:lltry) { psi[,i] = yeo.johnson(y, lambda=ltry[i]) } ## Not run: matplot(y, psi, type="l", ylim=c(-4, 4), lwd=2, lty=1:lltry, ylab="Yeo-Johnson transformation", col=1:lltry, las=1, main="Yeo-Johnson transformation with some values of lambda") abline(v=0, h=0) legend(x=c(1), y=c(-0.5), lty=1:lltry, legend=as.character(ltry), lwd=2, col=1:lltry) ## End(Not run)