require(lattice)
## validation for objects of class 'pls' or 'spls'
data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
liver.val <- valid(X, Y, ncomp = 5, mode = "regression",
method = "pls", validation = "Mfold")
plot(liver.val, criterion = "R2", type = "l", layout = c(2, 2))
## validation for objects of class 'plsda' or 'splsda'
data(srbct)
X <- srbct$gene
Y <- srbct$class
error <- valid(X, Y, ncomp = 10, method = "splsda", M = 3,
keepX = rep(10, 10), pred.method = "all")
plot(error, type = "l")
Run the code above in your browser using DataLab