ecca.cv: Sparse Canonical Correlation via Reduced-Rank Regression when...

View source: R/ecca.r

ecca.cvR Documentation

Sparse Canonical Correlation via Reduced-Rank Regression when both X and Y are high-dimensional, with Cross-Validation

Description

Performs group-sparse reduced-rank regression for CCA using either ADMM or CVXR solvers.

Usage

ecca.cv(
  X,
  Y,
  lambdas = 0,
  groups = NULL,
  r = 2,
  standardize = FALSE,
  rho = 1,
  B0 = NULL,
  nfold = 5,
  select = "lambda.min",
  eps = 1e-04,
  maxiter = 500,
  verbose = FALSE,
  parallel = FALSE,
  nb_cores = NULL,
  set_seed_cv = NULL,
  scoring_method = "mse",
  cv_use_median = FALSE
)

Arguments

X

Predictor matrix (n x p)

Y

Response matrix (n x q)

lambdas

Choice of regularization parameter

groups

List of index vectors defining groups of predictors

r

Target rank

standardize

Whether to scale variables

rho

ADMM parameter

B0

Initial value for the coefficient matrix (optional)

nfold

Number of cross-validation folds

select

Which lambda to select: "lambda.min" or "lambda.1se"

eps

Convergence threshold for ADMM

maxiter

Maximum number of ADMM iterations

verbose

Print diagnostics

parallel

Whether to run cross-validation in parallel

nb_cores

Number of cores to use for parallel processing (default is NULL, which uses all available cores)

set_seed_cv

Optional seed for reproducibility of cross-validation folds (de)

scoring_method

Method to score the model during cross-validation, either "mse" (mean squared error) or "trace" (trace of the product of matrices)

cv_use_median

Whether to use the median of the cross-validation scores instead of the mean. Default is FALSE.

Value

A list with elements:

U

Canonical direction matrix for X (p x r)

V

Canonical direction matrix for Y (q x r)

cor

Canonical covariances

loss

The prediction error 1/n * \| XU - YV\|^2


ccar3 documentation built on Sept. 16, 2025, 9:11 a.m.