require(lattice)
## validation for objects of class 'pls' or 'spls'
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
liver.pls <- pls(X, Y, ncomp = 3)
liver.perf <- perf(liver.pls, validation = "Mfold")
plot(liver.perf, criterion = "R2", type = "l", layout = c(2, 2))
Run the code above in your browser using DataLab