y <- seq(-4, 4, len = (nn <- 200))
ltry <- c(0, 0.5, 1, 1.5, 2) # Try these values of lambda
lltry <- length(ltry)
psi <- matrix(as.numeric(NA), nn, lltry)
for(ii in 1:lltry)
psi[,ii] <- yeo.johnson(y, lambda = ltry[ii])
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 = 1, y = -0.5, lty = 1:lltry, legend = as.character(ltry),
lwd = 2, col = 1:lltry)
Run the code above in your browser using DataLab