Learn R Programming

CCAGFA (version 1.0.8)

CCAcorr: Compute correlation between the views

Description

A function for estimating the canonical correlations between two data sets. This function can only be used for models learned based on two data sources, since canonical correlation is only defined for two sets.

Usage

CCAcorr(Y, model, threshold = 0.001)

Arguments

Y
The data given as a list of two N times D[m] matrices
model
A list of model parameters as returned by CCA.
threshold
Relative amount of variance explained that is needed for a component to be treated active (see CCAtrim).

Value

r
The correlations, a vector of length K.
active
A binary indicator telling which of the components are shared.

Details

The function computes the correlations for each component. The inactive ones are not suprressed away, but the variable active can be used for filtering them out; the correlations for the non-shared components should typically not be trusted. The estimated correlation corresponds to the correlation between the expected values of Z|Y[1] and Z|Y[2].

Examples

Run this code
  #
  # Assume we have a variable model which has been learned with
  # CCAexperiment() or CCA().
  #
  # output <- CCAcorr(model)
  #
  # print(output$r)                           # Print the correlations
  # print(output$r[which(output$active==1)])  # Only the shared components
  #

Run the code above in your browser using DataLab