transfo_newdata {cellWise} | R Documentation |
Transform variables based on the output of transfo
.
Description
Based on the output of transfo
, transform the variables using Yeo-Johnson and/or Box-Cox transformations with the previously estimated parameters and standardization.
Usage
transfo_newdata(Xnew, transfo.out)
Arguments
Xnew |
A data matrix with d columns, which contain the variables to be transformed. The number of columns and their names must be the same as those of the original data on which |
transfo.out |
The output of a call to |
Value
Returns a matrix with transformed variables.
Author(s)
J. Raymaekers and P.J. Rousseeuw
References
J. Raymaekers and P.J. Rousseeuw (2021). Transforming variables to central normality. Machine Learning. doi:10.1007/s10994-021-05960-5(link to open access pdf)
See Also
Examples
set.seed(123); tempraw <- matrix(rnorm(2000), ncol = 2)
tempx <- cbind(tempraw[, 1],exp(tempraw[, 2]))
tempy <- 0.5 * tempraw[, 1] + 0.5 * tempraw[, 2] + 1
x <- tempx[1:900, ]
y <- tempy[1:900]
tx.out <- transfo(x, type = "bestObj")
tx.out$ttypes
tx.out$lambdahats
tx <- tx.out$Y
lm.out <- lm(y ~ tx)
summary(lm.out)
xnew <- tempx[901:1000, ]
xtnew <- transfo_newdata(xnew, tx.out)
yhatnew <- tcrossprod(lm.out$coefficients, cbind(1, xtnew))
plot(tempy[901:1000], yhatnew); abline(0, 1)
[Package cellWise version 2.5.3 Index]