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])
}
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)
Run the code above in your browser using DataLab