rCCA:Nutrimouse

rCCA and estimation of the penalization parameters

Beforehand, we have to estimate λ1 and λ2 in rCCA. The regularization parameters were chosen using “leave-one-out” cross-validation procedure on a regular grid of size 51 x 51 defined on the region 0 < λ1 < 0.2, 0.0001 < λ2 < 0.2.

grid1 <- seq(0, 0.2, length = 51)
grid2 <- seq(0.0001, 0.2, length = 51)

## Depending on how fine your grid is, estim.regul may take some time
cv.score <- estim.regul(X, Y, grid1 = grid1, grid2 = grid2, plt = FALSE)

## Output obtained:
 lambda1 = 0.064
 lambda2 = 0.008096
CV-score = 0.8852923

Below is represented the CV-score for λ1 and λ2. The figure was completed by adding contour plots.

image(cv.score)

levels <- c(0, 0.5, 0.7, 0.8, 0.85, 0.88)
contour(cv.score$grid1, cv.score$grid2, cv.score$mat, add = T, levels = levels,
        col = "blue")

Once the regularization parameters are chosen, we can call the rcc function with the appropriate values for the parameters λ1 and λ2.

## Run rCCA given the optimal parameters:
result

A scree plot is useful to help choosing the number of the rCCA dimensions:

plot(result, scree.type = "barplot")

Next: Samples respresentation