pls: PLS

plsR Documentation

PLS

Description

Simple wrappers for fitting a PLS model using pls function of the mixOmics package. The object can then be passed to many of the mixOmics functions for prediction, performance evaluation etc. Also plot a scores plot of the first two components.

  • mixomics_pls A simple PLS model with set number of components and all features

  • mixomics_pls_optimize Test different numbers of components, choose the one with minimal mean square error

  • mixomics_spls_optimize sPLS model: Test different numbers of components and features, choose the one with minimal mean square error

Usage

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

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

mixomics_spls_optimize(
  object,
  y,
  ncomp,
  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 vector, column names of the grouping variable to predict

ncomp

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, colored by the y-variable. Only really makes sense if y is a single variable

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::pls or mixOmics::spls

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.

n_features

the number of features to try for each component

Value

an object of class "mixo_pls" or "mixo_spls"

See Also

pls, perf, spls, tune.spls

Examples

## Not run: 
pls_res <- mixomics_pls(merged_sample, y = "Injection_order", ncomp = 3)
pls_opt <- mixomics_pls_optimize(merged_sample, y = "Injection_order", ncomp = 3)
pls_res <- mixomics_spls_optimize(merged_sample,
  y = "Injection_order", ncomp = 3,
  n_features <- c(1:10, 12, 15, 20)
)

## End(Not run)

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