Learn R Programming

mixOmics (version 5.0-3)

splsda: Sparse Partial Least Squares Discriminate Analysis (sPLS-DA)

Description

Function to perform sparse Partial Least Squares to classify samples. The sPLS-DA approach embeds variable selection for this purpose.

Usage

splsda(X, Y, ncomp = 2, keepX = rep(ncol(X), ncomp),
       max.iter = 500, tol = 1e-06, near.zero.var = TRUE, ...)

Arguments

X
numeric matrix of predictors. NAs are allowed.
Y
a factor or a class vector for the discrete outcome.
ncomp
the number of components to include in the model (see Details).
keepX
numeric vector of length ncomp, the number of variables to keep in $X$-loadings. By default all variables are kept in the model.
max.iter
integer, the maximum number of iterations.
tol
a positive real, the tolerance used in the iterative algorithm.
near.zero.var
boolean, see the internal 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.
...
arguments to pass to nearZeroVar.

Value

  • splsda returns an object of class "splsda", a list that contains the following components:
  • Xthe centered and standardized original predictor matrix.
  • Ythe centered and standardized indicator response vector or matrix.
  • ind.matthe indicator matrix.
  • ncompthe number of components included in the model.
  • keepXnumber of $X$ variables kept in the model on each component.
  • mat.cmatrix of coefficients to be used internally by predict.
  • variateslist containing the variates.
  • loadingslist containing the estimated loadings for the X and Y variates.
  • nameslist containing the names to be used for individuals and variables.
  • nzvlist containing the zero- or near-zero predictors information.
  • tolthe tolerance used in the iterative algorithm, used for subsequent S3 methods
  • max.iterthe maximum number of iterations, used for subsequent S3 methods

encoding

latin1

Details

splsda function fit sPLS models with $1, \ldots ,$ncomp components to the factor or class vector Y. The appropriate indicator matrix is created.

References

On sPLS-DA: L� Cao, K.-A., Boitard, S. and Besse, P. (2011). Sparse PLS Discriminant Analysis: biologically relevant feature selection and graphical displays for multiclass problems. BMC Bioinformatics 12:253.

See Also

spls, summary, plotIndiv, plotVar, plot3dIndiv, plot3dVar, cim, network, predict, perf and http://www.math.univ-toulouse.fr/~biostat/mixOmics/ for more details.

Examples

Run this code
## 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