# NOT RUN {
data(vargas.txe)
require(lattice)
levelplot(vargas.txe$yields, col.regions=RedGrayBlue,
main="vargas.txe", xlab="year", ylab="treatment")
Z <- vargas.txe$yields
Z <- sweep(Z, 1, rowMeans(Z))
Z <- sweep(Z, 2, colMeans(Z)) # Double-centered like AMMI
# Vargas figure 1
biplot(prcomp(Z, scale.=FALSE), main="vargas.txe")
# }
# NOT RUN {
# Now, PLS relating the two matrices
U <- vargas.txe$covs
U <- scale(U) # Standardized covariates
require(pls)
m1 <- plsr(Z~U)
# Vargas Fig 2, flipped vertical/horizontal
biplot(m1, which="x", var.axes=TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab