Compute CPLS decomposition for large on-disk BPCells matrices. CPLS uses canonical correlation analysis (CCA) to determine loading weights, which can improve performance with multi-response or mixed-type response data.

# S3 method for class 'IterableMatrix'
cppls_ondisk(
  X,
  Y,
  Y.add = NULL,
  ncomp,
  center = TRUE,
  stripped = FALSE,
  w.tol = 0,
  X.tol = 1e-12,
  threads = 1L,
  ...
)

Arguments

X

An IterableMatrix (features x samples, the BPCells convention). The transpose is handled internally.

Y

A matrix or vector of primary responses (samples x q).

Y.add

A matrix of additional responses (samples x q_add), or NULL. Y.add provides information that guides loading weights but does not enter the regression coefficients.

ncomp

Integer; number of PLS components to compute.

center

Logical; whether to center X and Y (default TRUE).

stripped

Logical; if TRUE return only coefficients, Xmeans, and Ymeans for speed (default FALSE).

w.tol

Numeric; threshold for zeroing small loading weights (default 0).

X.tol

Numeric; threshold for small-norm variable detection (default 1e-12).

threads

Integer; number of threads for BPCells parallel computation. 1 (default) = single-threaded; 0 = auto-detect via parallel::detectCores(logical = FALSE); values \(\ge 2\) use that many threads.

...

Additional arguments (currently unused).

Value

A list with components:

coefficients

Regression coefficients (p x q x ncomp array).

scores

X-scores (n x ncomp matrix).

loadings

X-loadings (p x ncomp matrix).

loading.weights

Loading weights (p x ncomp matrix).

Yscores

Y-scores (n x ncomp matrix).

Yloadings

Y-loadings (q x ncomp matrix).

projection

Projection matrix (p x ncomp matrix).

Xmeans

Column means of X (length p).

Ymeans

Column means of Y (length q).

fitted.values

Fitted Y values (n x q x ncomp array).

residuals

Residuals (n x q x ncomp array).

Xvar

Variance explained in X per component (length ncomp).

Xtotvar

Total variance in X (scalar).

gammas

Power values per component (0.5 for all in this implementation).

canonical.correlations

Squared canonical correlations per component.

A

CCA weight vectors (q_full x ncomp matrix).

smallNorm

Indices of near-zero-norm variables.

If stripped = TRUE, only coefficients, Xmeans, Ymeans, gammas, canonical.correlations, A, and smallNorm are returned.