
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.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 (dummy)
matrix is created.spls
, summary
,
plotIndiv
, plotVar
,
plot3dIndiv
, plot3dVar
,
cim
, network
, predict
, perf
and http://www.mixOmics.org for more details.## First example
data(breast.tumors)
X <- breast.tumors$gene.exp
# Y will be transformed as a factor in the function,
# but we set it as a factor to set up the colors.
Y <- as.factor(breast.tumors$sample$treatment)
res <- splsda(X, Y, ncomp = 2, keepX = c(25, 25))
# individual names appear
plotIndiv(res, ind.names = Y, add.legend = TRUE, plot.ellipse =TRUE)
## Second example
## Second example
data(liver.toxicity)
X <- as.matrix(liver.toxicity$gene)
# Y will be transformed as a factor in the function,
# but we set it as a factor to set up the colors.
Y <- as.factor(liver.toxicity$treatment[, 4])
splsda.liver <- splsda(X, Y, ncomp = 2, keepX = c(20, 20))
# individual name is set to the treatment
plotIndiv(splsda.liver, ind.names = Y, plot.ellipse = TRUE, add.legend = TRUE)
Run the code above in your browser using DataLab