# NOT RUN {
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
toxicity.spls <- spls(X, Y, ncomp = 2, keepX = c(50, 50), keepY = c(10, 10))
ex = explained_variance(toxicity.spls$X, toxicity.spls$variates$X, ncomp =2)
# ex should be the same as
toxicity.spls$explained_variance$X
# }
Run the code above in your browser using DataLab