rv.coef(mat, indices)
indices
.The RV-coefficient, for a (coumn-centered) data matrix (with p variables/columns) X, and for the regression of these columns on a k-variable subset, is given by: $$RV = \frac{\mathrm{tr}(X X^t \cdot (P_v X)(P_v X)^t)} {\sqrt{\mathrm{tr}((X X^t)^2) \cdot \mathrm{tr}(((P_v X) (P_v X)^t)^2)} }$$ where $P_v$ is the matrix of orthogonal projections on the subspace defined by the k-variable subset.
This definition is equivalent to the expression used in the code, which only requires the covariance (or correlation) matrix of the data under consideration.
data(iris3)
x<-iris3[,,1]
rv.coef(var(x),c(1,3))
## [1] 0.8659685
Run the code above in your browser using DataLab