rCCA: Sparse Canonical Correlation Analysis

Description Usage Arguments Value Examples

View source: R/rcca.R

Description

Sparse Canonical Correlation Analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
rCCA(
  X1,
  X2,
  l1 = 0.3,
  l2 = 0.3,
  K = 1,
  niter = 1000,
  threshold = 1e-06,
  verbose = TRUE
)

Arguments

X1, X2

Matrices of covariates.

l1, l2

Penalisation terms.

K

Number of canonical vector pairs.

niter

Number of iterations to run algorithm for (default = 1000).

threshold

Stopping criterea threshold (default = 1e-6).

verbose

Print debug information.

Value

List with canonical vectors w1, w2 and the correlation for the kth canonical vector pair given as t(w1) %% t(X1) %% X2 %*% w2.

Examples

1
2
3
4
5
6
7
8
9
# From PMA::CCA
u <- matrix(c(rep(1,25),rep(0,75)),ncol=1)
v1 <- matrix(c(rep(1,50),rep(0,450)),ncol=1)
v2 <- matrix(c(rep(0,50),rep(1,50),rep(0,900)),ncol=1)
X1 <- u%*%t(v1) + matrix(rnorm(100*500),ncol=500)
X2 <- u%*%t(v2) + matrix(rnorm(100*1000),ncol=1000)
X1 <- scale(X1, T, F)
X2 <- scale(X2, T, F)
cca <- rCCA(X1, X2)

mkomod/rcca documentation built on Jan. 28, 2021, 4:56 p.m.