pls_da: PLS-DA

pls_daR Documentation

PLS-DA

Description

A simple wrapper for fitting a PLS-DA model using plsda function of the mixOmics package. The object can then be passed to many of the mixOmics functions for prediction, performance evaluation etc.

  • mixomics_plsda A simple PLS-DA model with set number of components and all features

  • mixomics_plsda_optimize Test different numbers of components, choose the one with minimal balanced error rate

  • mixomics_splsda_optimize sPLS-DA model: Test different numbers of components and features, choose the one with minimal balanced error rate

Usage

mixomics_plsda(
  object,
  y,
  ncomp,
  plot_scores = TRUE,
  all_features = FALSE,
  covariates = NULL,
  ...
)

mixomics_plsda_optimize(
  object,
  y,
  ncomp,
  folds = 5,
  nrepeat = 50,
  plot_scores = TRUE,
  all_features = FALSE,
  covariates = NULL,
  ...
)

mixomics_splsda_optimize(
  object,
  y,
  ncomp,
  dist,
  n_features = c(1:10, seq(20, 300, 10)),
  folds = 5,
  nrepeat = 50,
  plot_scores = TRUE,
  all_features = FALSE,
  covariates = NULL,
  ...
)

Arguments

object

a MetaboSet object

y

character, column name of the grouping variable to predict

ncomp

the number of X components

plot_scores

logical, if TRUE, a scatter plot with the first two PLS-components as x and y-axis will be drawn, with both prediction surface and ellipses

all_features

logical, should all features be included in the model? if FALSE, flagged features are left out

covariates

character, column names of pData to use as covariates in the model, in addition to molecular features

...

any parameters passed to mixOmics::plsda

folds

the number of folds to use in k-fold cross validation

nrepeat

the number of times to repeat the cross validation. Lower this for faster testing.

dist

the distance metric to use, one of "max.dist", "mahalanobis.dist", "centroids.dist". use mixomics_plsda_optimize to find the best distance metric

n_features

the number of features to try for each component

Value

an object of class "mixo_plsda"

See Also

plsda, perf, splsda, tune.splsda

Examples

## Not run: 
noqc <- drop_qcs(merged_sample)
plsda_res <- mixomics_plsda(noqc, y = "Group", ncomp = 2)
set.seed(38)
plsda_opt <- mixomics_plsda_optimize(noqc, y = "Group", ncomp = 3)
set.seed(38)
splsda_opt <- mixomics_splsda_optimize(noqc,
  y = "Group", dist = "max.dist", ncomp = 2,
  n_features <- c(1:10, 12, 15, 20)
)

## End(Not run)

antonvsdata/notame documentation built on Sept. 14, 2024, 11:09 p.m.