View source: R/reduceFeatures-functions.R
reducePLSDA | R Documentation |
Performs PLS-DA on a matrix-like object where rows represent features and columns represent samples.
reducePLSDA(x, y, ncomp = 2, center = TRUE, scale = FALSE, ...)
x |
A matrix-like object. |
y |
A factor vector for the information about each sample's group. |
ncomp |
A integer specifying the number of components to extract. |
center |
A logical specifying whether |
scale |
A logical specifying whether the unit variance scaling needs to
be performed on |
... |
Additional arguments passed to pls::plsr. |
This function performs standard PLS for classification with the transpose of
x
using the pls::plsr. Since PLS-DA is a supervised method, users must
supply the information about each sample's group. Here, y
must be a factor
so that it can be internally converted to an indicator matrix. The function
returns a reduced.plsda
object that is a matrix with custom attributes to
summarize (via summary) and visualize (via plotReduced) the PLS-DA
result. The custom attributes include the following:
method
: The method used to reduce the dimension of data.
ncomp
: The number of components extracted.
explvar
: A vector indicating the amount of X variance explained by
each component.
responses
: A vector indicating the levels of factor y
.
predictors
: A vector of predictor variables.
coefficient
: An array of regression coefficients.
loadings
: A matrix of loadings.
loadings.weights
: A matrix of loading weights.
Y.observed
: A vector of observed responses.
Y.predicted
: A vector of predicted responses.
Y.scores
: A matrix of Y-scores.
Y.loadings
: A matrix of Y-loadings.
projection
: The projection matrix.
fitted.values
: An array of fitted values.
residuals
: An array of regression residuals.
centered
: A logical indicating whether the data was mean-centered prior
to PLS-DA.
scaled
: A logical indicating whether the data was scaled prior to
PLS-DA.
A reduced.plsda object with the same number of rows as
ncol(x)
containing the dimension reduction result.
Kristian Hovde Liland, Bjørn-Helge Mevik and Ron Wehrens (2021). pls: Partial Least Squares and Principal Component Regression. R package version 2.8-0. https://CRAN.R-project.org/package=pls
See reduceFeatures that provides a SummarizedExperiment-friendly wrapper for this function.
See plotReduced for visualization.
See pls::plsr for the underlying function that does the work.
data(faahko_se)
m <- assay(faahko_se, "knn_vsn")
y <- factor(colData(faahko_se)$sample_group)
res <- reducePLSDA(m, y = y)
summary(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.