# First example
data(breast.tumors)
X <- breast.tumors$gene.exp
Y <- as.factor(breast.tumors$sample$treatment)
res <- splsda(X, Y, ncomp = 2, keepX = c(25, 25))
palette(c("red", "blue"))
plotIndiv(res, ind.names = TRUE, col = as.numeric(Y))
legend(-0.35, -0.19, c("After", "Before"), pch = c(16, 16),
col = c("red", "blue"), cex = 1, pt.cex = c(1.2, 1.2),
title = "Treatment")
palette("default")
# Second example
data(liver.toxicity)
X = as.matrix(liver.toxicity$gene)
Y = as.factor(liver.toxicity$treatment[,4])
ncomp = 2
keepX = 20
splsda.liver = splsda(X, Y, ncomp = ncomp, keepX = c(rep(keepX, ncomp)), mode = 'regression')
col = as.numeric(Y)
plotIndiv(splsda.liver, col = col)
Run the code above in your browser using DataLab