| normYJpn | R Documentation |
Computes (normalized) extended Yeo-Johnson transformation
normYJpn(X, Col2Tra, la, Jacobian = TRUE, inverse = FALSE, trace = FALSE, ...)
X |
The data matrix: |
Col2Tra |
Which variables to transform. An integer vector of length |
la |
Transformation parameters. A |
Jacobian |
Requested Jacobian of transformed values. If |
inverse |
Wheather to return the inverse transformation. The default is |
trace |
Whether to print intermediate results. Default is |
... |
potential further arguments passed to lower level functions. |
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
The transformed data matrix.
FSDA team, valentin.todorov@chello.at
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.