Simple wrappers for fitting a PLS model using mixOmics package. The result can then be passed to many of the mixOmics functions for prediction, performance evaluation etc.
Usage
mixomics_pls(
object,
y,
ncomp,
plot_scores = TRUE,
all_features = FALSE,
covariates = NULL,
assay.type = NULL,
...
)
mixomics_pls_optimize(
object,
y,
ncomp,
folds = 5,
nrepeat = 50,
plot_scores = TRUE,
all_features = FALSE,
covariates = NULL,
assay.type = NULL,
...
)
mixomics_spls_optimize(
object,
y,
ncomp,
n_features = c(seq_len(10), seq(20, 300, 10)),
folds = 5,
nrepeat = 50,
plot_scores = TRUE,
all_features = FALSE,
covariates = NULL,
assay.type = NULL,
...
)
Arguments
- object
a
SummarizedExperiment
orMetaboSet
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 pheno datato use as covariates in the model, in addition to molecular features
- assay.type
character, assay to be used in case of multiple assays
- ...
- 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
Details
mixomics_pls
A simple PLS model with set number of components and all featuresmixomics_pls_optimize
Test different numbers of componentsmixomics_spls_optimize
sPLS model: Test different numbers of components and features
Examples
data(example_set)
pls_res <- mixomics_pls(example_set, y = "Injection_order", ncomp = 3)
#> INFO [2025-06-23 22:37:54] Fitting PLS
# Cross-validation repeated only 5 times for quick run time
pls_opt <- mixomics_pls_optimize(example_set,
y = "Injection_order", ncomp = 3, nrepeat = 5)
#> INFO [2025-06-23 22:37:55] Fitting PLS
#> INFO [2025-06-23 22:37:55] Evaluating PLS performance
#> INFO [2025-06-23 22:37:55] Choosing a PLS model with 1 component(s) based on the minimal MSE
#> Take a look at the plot and make sure this is the correct number of components
#> INFO [2025-06-23 22:37:55] Fitting PLS
spls_opt <- mixomics_spls_optimize(example_set,
y = "Injection_order", ncomp = 3,
n_features <- c(1:10, 12, 15, 20), nrepeat = 5
)
#> INFO [2025-06-23 22:37:55] Tuning sPLS
#> INFO [2025-06-23 22:37:59] Final model has 1 components with the numbers of features: 20