PLSDA: Partial Least Squares Discriminant Analysis

View source: R/plsda_batch.R

PLSDAR Documentation

Partial Least Squares Discriminant Analysis

Description

This function estimates latent dimensions from the explanatory matrix X. The latent dimensions are maximally associated with the outcome matrix Y. It is a built-in function of PLSDA_batch.

Usage

PLSDA(X, Y, ncomp, keepX = rep(ncol(X), ncomp), tol = 1e-06, max.iter = 500)

Arguments

X

A numeric matrix that is centered and scaled as an explanatory matrix. NAs are not allowed.

Y

A dummy matrix that is centered and scaled as an outcome matrix.

ncomp

Integer, the number of dimensions to include in the model.

keepX

A numeric vector of length ncomp, the number of variables to keep in X-loadings. By default all variables are kept in the model. A valid input of keepX extends PLSDA to a sparse version.

tol

Numeric, convergence stopping value.

max.iter

Integer, the maximum number of iterations.

Value

PLSDA returns a list that contains the following components:

original_data

The original explanatory matrix X and outcome matrix Y.

defl_data

The centered and scaled deflated matrices (\hat{X} and \hat{Y}) after removing the variance of latent components calculated with estimated latent dimensions.

latent_comp

The latent components calculated with estimated latent dimensions.

loadings

The estimated latent dimensions.

iters

Number of iterations of the algorthm for each component.

exp_var

The amount of data variance explained per component (note that contrary to PCA, this amount may not decrease as the aim of the method is not to maximise the variance, but the covariance between X and the dummy matrix Y).

Author(s)

Yiwen Wang, Kim-Anh LĂȘ Cao

References

\insertRef

barker2003partialPLSDAbatch

Examples

# A built-in function of PLSDA_batch, not separately used.
# Not run
data('AD_data')
library(mixOmics)
library(TreeSummarizedExperiment)

X <- assays(AD_data$EgData)$Clr_value
Y.trt <- rowData(AD_data$EgData)$Y.trt
names(Y.trt) <- rownames(AD_data$EgData)

X.scale <- scale(X, center = TRUE, scale = TRUE)

# convert Y.trt to be a dummy matrix
Y.trt.mat <- unmap(as.numeric(Y.trt))
Y.trt.scale <- scale(Y.trt.mat, center = TRUE, scale = TRUE)

ad_plsda.trt <- PLSDA(X.scale, Y.trt.scale, ncomp = 1)
# the latent components associated with Y.trt:
X.compnt <- ad_plsda.trt$latent_comp$t



EvaYiwenWang/PLSDAbatch documentation built on Sept. 25, 2024, 8:54 p.m.