normYJpn: Computes (normalized) extended Yeo-Johnson transformation

View source: R/normYJpn.R

normYJpnR Documentation

Computes (normalized) extended Yeo-Johnson transformation

Description

Computes (normalized) extended Yeo-Johnson transformation

Usage

normYJpn(X, Col2Tra, la, Jacobian = TRUE, inverse = FALSE, trace = FALSE, ...)

Arguments

X

The data matrix: n observations and p variables. The rows of X represent observations, and the columns represent variables. Missing values (NA's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations.

Col2Tra

Which variables to transform. An integer vector of length k specifying the variables which must be transformed. If it is missing and length(la)=p all variables are transformed

la

Transformation parameters. A k x 2 matrix containing set of transformation parameters for the k Col2Tra variables. The first column contains the transformation parameter for positive observations and the second column the transformation parameter for negative observations.

Jacobian

Requested Jacobian of transformed values. If Jacobian=TRUE the default, the transformation is normalized to have Jacobian equal to 1. Note that this optional argument is ignored if inverse=TRUE.

inverse

Wheather to return the inverse transformation. The default is inverse=FALSE.

trace

Whether to print intermediate results. Default is trace=FALSE.

...

potential further arguments passed to lower level functions.

Details

The transformations for negative and positive responses were determined by Yeo and Johnson (2000) by imposing the smoothness condition that the second derivative of zYJ(\lambda) with respect to y be smooth at y = 0. However some authors, for example Weisberg (2005), query the physical interpretability of this constraint which is oftern violated in data analysis. Accordingly, Atkinson et al (2019) and (2020) extend the Yeo-Johnson transformation to allow two values of the transformations parameter: \lambda N for negative observations and \lambda P for non-negative ones.

The Yeo-Johnson transformation is the Box-Cox transformation of y+1 for nonnegative values, and of |y|+1 with parameter 2-\lambda for y negative

Value

The transformed data matrix.

Author(s)

FSDA team, valentin.todorov@chello.at

References

Atkinson, A.C. Riani, M., Corbellini A. (2019), The analysis of transformations for profit-and-loss data, Journal of the Royal Statistical Society, Series C, "Applied Statistics", https://doi.org/10.1111/rssc.12389

Atkinson, A.C. Riani, M. and Corbellini A. (2021), The Box–Cox Transformation: Review and Extensions, "Statistical Science", Vol. 36, pp. 239-255, https://doi.org/10.1214/20-STS778

Yeo, I.K and Johnson, R. (2000), A new family of power transformations to improve normality or symmetry, "Biometrika", Vol. 87, pp. 954-959.

Examples


 ## Not run: 
 
 ##  Example of use of normYJ() with all default options.
 ##  Transform value -3, -2, ..., 3
 y <- (-3):3
 lambda <- c(-0.5, 0.5)
 y1 <- normYJpn(y, Col2Tra=1, la=lambda)
 plot(y, y1, xlab='Original values', ylab='Transformed values') 
 
 ## Compare Yeo and Johnson with extended Yeo and Yohnson.
 ## Transform value -3, -2, ..., 3
 k <- 3
 y <- seq(from=-k, to=k, by=0.01)
 
 ## Two values of lambda for extended Yeo and Johnson
 lambda <- c(0, 0.5)
 Jacobian <- FALSE
 ## Just one value of lambda for traditional Yao and Johnson
 y1 <- normYJ(y,Col2Tra=1, la=lambda[1], Jacobian=Jacobian)
 ypn <- normYJpn(y, Col2Tra=1, la=lambda,Jacobian=Jacobian)
 
 plot(y, y1, type="l", xlab="Original values", ylab="Transformed values", col="blue")
 lines(y, ypn, col="red")
 
 
## End(Not run)


fsdaR documentation built on May 20, 2026, 1:07 a.m.