ComDim_OPLS: ComDim_OPLS

View source: R/ComDim_OPLS.R

ComDim_OPLSR Documentation

ComDim_OPLS

Description

Finding common dimensions in multi-block datasets using OPLS. Also known as ConsensusOPLS (ComDim-OPLS) for multiblock structures: orthogonal components uncorrelated with Y are extracted from all blocks simultaneously before the predictive components are computed.

Usage

ComDim_OPLS(
  MB = MB,
  y = y,
  ndim = 1,
  nort = 1,
  method = c("OPLS-DA", "OPLS-R"),
  decisionRule = c("fixed", "max")[2],
  normalise = FALSE,
  loquace = FALSE,
  cv.k = 7
)

Arguments

MB

A MultiBlock object.

y

The Y-block. A class vector or dummy matrix for OPLS-DA, or a numeric matrix/vector for OPLS-R.

ndim

Number of predictive Common Dimensions. Default is 1.

nort

Maximum number of orthogonal Common Dimensions. Default is 1. The actual number used is determined by ConsensusOPLS cross-validation and may be less than this value.

method

'OPLS-DA' for discriminant analysis or 'OPLS-R' for regression.

decisionRule

Only used if method is 'OPLS-DA'. If 'fixed', samples are assigned to the class with Y-hat above 1/nclasses. If 'max', samples are assigned to the class with the highest Y-hat.

normalise

To apply block normalisation. FALSE == no (default), TRUE == yes.

loquace

To display the calculation times. TRUE == yes, FALSE == no (default).

cv.k

Number of folds for k-fold cross-validation (default 7). Set to 0 to skip CV output. ConsensusOPLS always performs internal CV to select the optimal number of orthogonal components; when cv.k >= 2 the resulting Q2 and DQ2 reflect that cross-validation.

Details

This function is a wrapper around ConsensusOPLS. The core kernel-OPLS extraction is delegated to that package; all ComDim output slots (local scores, loadings, VIP, sensitivity, confusion matrix, etc.) are computed from the returned model objects.

Value

A ComDim object. All slots are populated. Key slots:

Method

"OPLS-DA" or "OPLS-R".

ndim

Number of predictive Common Dimensions.

Q.scores

Predictive global scores matrix (n \times ndim).

T.scores

Named list of block-specific predictive local scores.

P.loadings

Global predictive loadings.

Saliences

Predictive block salience matrix (ntable \times ndim).

Orthogonal

List with orthogonal component outputs: nort, Q.scores, T.scores, P.loadings.ort, Saliences.ort.

R2X

Named vector (length ndim + nort) of X-variance fractions.

R2Y

Named vector (length ndim + nort) of Y-variance fractions.

Q2

Cross-validated Q2 per class/response (when cv.k >= 2; otherwise training-set fit).

DQ2

(OPLS-DA only) Cross-validated discriminant Q2 per class.

VIP

Global total VIP (named vector, length p_{tot}).

VIP.block

Named list (one data.frame per block) with columns p, o, tot.

PLS.model

KOPLS regression objects: W, B, B0, Y.

cv

Cross-validation results when cv.k >= 2: k, Ypred, Q2, DQ2.

Prediction

Training-set predictions: Y.pred; for OPLS-DA also decisionRule, trueClass, predClass, Sensitivity, Specificity, confusionMatrix.

Mean

List with MeanMB and MeanY.

Norm

List with NormMB, FrobNorms, RVweights.

variable.block

Block membership of each variable.

runtime

Total computation time in seconds.

References

Boccard J, Rutledge DN (2013). A consensus OPLS-DA strategy for multiblock Omics data fusion. Analytica Chimica Acta, 769, 30–39. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.aca.2013.01.022")}

Examples

b1 <- matrix(rnorm(500), 10, 50)
b2 <- matrix(rnorm(800), 10, 80)
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))
y <- rep(c("A", "B"), 5)
results <- ComDim_OPLS(mb, y, ndim = 1, nort = 1, method = "OPLS-DA")

R.ComDim documentation built on May 13, 2026, 9:07 a.m.