
Partial Least Squares Discriminant Analysis (PLS-DA)
gly_plsda.RdPerform partial least squares discriminant analysis on the expression data.
The function uses ropls::opls() to perform PLS-DA and returns tidy results.
Usage
gly_plsda(
exp,
group_col = "group",
ncomp = 2,
scale = TRUE,
add_info = TRUE,
...,
log_transform = TRUE
)Arguments
- exp
A
glyexp::GlycomicSE()orglyexp::GlycoproteomicSE()object, or anotherSummarizedExperimentcontaining an expression matrix and sample information.- group_col
A character string specifying the column name in sample information that contains group labels. Default is "group".
- ncomp
An integer indicating the number of components to include. Default is 2.
- scale
A logical indicating whether to scale the data. Default is TRUE.
- add_info
A logical value. If TRUE (default), sample and variable information from the experiment will be added to the result tibbles. If FALSE, only the PLS-DA results are returned.
- ...
Additional arguments passed to
ropls::opls().- log_transform
A single logical value indicating whether to transform expression values using
log(x + 1)before analysis. Default isTRUE. Set toFALSEfor data that are already log-transformed.
Value
A list containing:
tidy_result: A list of tibbles with PLS-DA results:samples: PLS-DA scores for each sample containing the following columns:sample: Sample namegroup: Group assignmentp1,p2, etc.: PLS-DA component scores
variables: PLS-DA loadings for each variable containing the following columns:variable: Variable namep1,p2, etc.: PLS-DA component loadingspcorr1,pcorr2, etc.: Correlation between each variable and component
variance: PLS-DA explained variance containing the following columns:component: Component name (p1, p2, etc.)prop_var_explained: Proportion of variance explained by each componentcumulative_prop_var: Cumulative proportion of variance explained
vip: Variable Importance in Projection scores containing the following columns:variable: Variable namevip: VIP score
perm_test: Permutation test results containing the following columns:model: Model type ("Original" for the original model, "Permutation" for permuted models)perm_id: Permutation ID (0 for original model, 1+ for permutations)Additional columns from the permutation test matrix (e.g., R2X, R2Y, Q2, etc.)
raw_result: The raw ropls opls object fromropls::opls()meta_data: A list containing metadata from the input experiment
Details
By default, expression values are transformed using log(x + 1) before
analysis. Set log_transform = FALSE to use the expression values as supplied,
for example when they are already log-transformed.
Required packages
This function requires the following packages to be installed:
roplsfor PLS-DA analysis