splsda(X, Y, ncomp = 2, keepX = rep(ncol(X), ncomp),
max.iter = 500, tol = 1e-06, near.zero.var = TRUE, ...)
NA
s are allowed.ncomp
, the number of variables
to keep in $X$-loadings. By default all variables are kept in the model.nearZeroVar
function (should be set to TRUE in particular for data with many zero values). Setting this argument to FALSE (when appropriate) will speed up the computations.nearZeroVar
.splsda
returns an object of class "splsda"
, a list
that contains the following components:predict
.X
and
Y
variates.splsda
function fit sPLS models with $1, \ldots ,$ncomp
components
to the factor or class vector Y
. The appropriate indicator
matrix is created.spls
, summary
,
plotIndiv
, plotVar
,
plot3dIndiv
, plot3dVar
,
cim
, network
, predict
, valid
and http://www.math.univ-toulouse.fr/~biostat/mixOmics/ for more details.## First example
data(breast.tumors)
X <- breast.tumors$gene.exp
Y <- breast.tumors$sample$treatment
res <- splsda(X, Y, ncomp = 2, keepX = c(25, 25))
palette(c("red", "blue"))
col.breast <- as.numeric(as.factor(Y))
plotIndiv(res, ind.names = TRUE, col = col.breast)
legend('bottomleft', c("After", "Before"), pch = c(16, 16),
col = unique(col.breast), 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 <- liver.toxicity$treatment[, 4]
splsda.liver = splsda(X, Y, ncomp = 2, keepX = c(20, 20))
col.rat <- as.numeric(as.factor(Y))
plotIndiv(splsda.liver, col = col.rat, ind.names = Y)
Run the code above in your browser using DataLab