Compute the test statistic as a function of canonical correlations.
test_stat_CCA.Rd
Given a sample covariance matrix \(S\) and a group of variables \(P\), first computes the cross-covariance matrix between the whitened variables: \(S_{P, P^c}^W = S_{P, P}^{-0.5} S_{P, P^c} S_{P^c, P^c}^{-0.5}\). Next, computes the SVD of \(S_{P, P^c}^W\) and returns the test statistic, \(S_{P, P}\), \(S_{P^c, P^c}\) and the canonical vectors of \(S_{P, P^c}\).
Arguments
- S
a \(p \times p\) sample covariance matrix
- CP
a vector of length \(p\) with \(i^{th}\) element denoting the group \(i^{th}\) variable belongs to
- k
the group to be tested for independence with the remaining variables, i.e. \(P = i : CP[i]==k\)
Value
A list containing the following items:
- statistic
Test statistic corresponding to \(S\) and group of variables \(P\).
- S11
\(S_{P, P}\) if \(2|P| \ge p\), else \(S_{P^c, P^c}\).
- S22
\(S_{P^c, P^c}\) if \(2|P| \ge p\), else \(S_{P, P}\).
- left_SV
Left canonical vectors of \(S_{P, P^c}\).
- right_SV
Right canonical vectors of \(S_{P, P^c}\).