reduce_plsda: Partial least squares-discriminant analysis (PLS-DA)

Description Usage Arguments Value References See Also Examples

Description

Apply PLS-DA to a matrix or poplin object. It performs standard PLS for classification using the plsr function from the pls package.

Usage

1
2
3
4
5
## S4 method for signature 'matrix'
reduce_plsda(x, y, ncomp = 2, center = TRUE, scale = FALSE, ...)

## S4 method for signature 'poplin'
reduce_plsda(x, xin, xout, y, ncomp = 2, center = TRUE, scale = FALSE, ...)

Arguments

x

A matrix or poplin object.

y

A factor vector for discrete outcome.

ncomp

output dimensionality.

center

Logical indicating mean-centering prior to PLS-DA.

scale

Logical indicating unit variance scaling prior to PLS-DA.

...

Additional arguments passed to plsr.

xin

character specifying the name of data to retrieve from x when x is a poplin object.

xout

character specifying the name of data to store in x when x is a poplin object.

Value

A poplin.plsda or poplin object with the same number of rows as ncol(x) containing the dimension reduction result. poplin.plsda is a matrix containing custom attributes used to summarize and visualize the PLS-DA result.

References

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 Also

Other data reduction methods: poplin_reduce(), reduce_pca(), reduce_tsne()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(faahko_poplin)

if (requireNamespace("pls", quietly = TRUE)) {
  ## response vector
  y <- factor(colData(faahko_poplin)$sample_group, levels = c("WT", "KO"))

  ## poplin object
  out <- reduce_plsda(faahko_poplin, xin = "knn_cyclic", xout = "plsda",
                      y = y)
  summary(poplin_reduced(out, "plsda"))

  ## matrix
  m <- poplin_data(faahko_poplin, "knn_cyclic")
  out <- reduce_plsda(m, y = y, ncomp = 3)
  summary(out)
}

jaehyunjoo/poplin documentation built on Jan. 8, 2022, 1:13 a.m.