Title: | Correlation Coefficients for Multivariate Data |
Version: | 1.1 |
Date: | 2025-01-08 |
Author: | Michail Tsagris [aut, cre] |
Maintainer: | Michail Tsagris <mtsagris@uoc.gr> |
Depends: | R (≥ 4.0) |
Imports: | Rfast, stats |
Suggests: | corrfuns, Rfast2 |
Description: | Correlation coefficients for multivariate data, namely the squared correlation coefficient and the RV coefficient (multivariate generalization of the squared Pearson correlation coefficient). References include Mardia K.V., Kent J.T. and Bibby J.M. (1979). "Multivariate Analysis". ISBN: 978-0124712522. London: Academic Press. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | no |
Packaged: | 2025-01-08 17:18:32 UTC; mtsag |
Repository: | CRAN |
Date/Publication: | 2025-01-08 19:20:02 UTC |
Correlation Coefficients for Multivariate Data
Description
Correlation Coefficients for Multivariate Data.
Details
Package: | mvcor |
Type: | Package |
Version: | 1.1 |
Date: | 2025-01-08 |
License: | GPL-2 |
Maintainers
Michail Tsagris <mtsagris@uoc.gr>.
Author(s)
Michail Tsagris mtsagris@uoc.gr
Adjusted RV correlation between two sets of variables
Description
Adjusted RV correlation between two sets of variables.
Usage
arv(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
The adjusted RV correlation coefficient is computed.
Value
The value of the adjusted RV coefficient.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Mordant G. and Segers J. (2022). Measuring dependence between random vectors via optimal transport. Journal of Multivariate Analysis, 189: 104912.
See Also
Examples
arv( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
Dissimilarity between two data matrices based on the RV coefficient
Description
Dissimilarity between two data matrices based on the RV coefficient.
Usage
drv(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
The dissimilarity between the two data matrices is computed as \sqrt{2}\sqrt{1-RV(y, x)}
, where RV(y,x)
is the RV coefficient.
Value
The value of the dissimilarity.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Josse J., Pages J. and Husson F. (2008). Testing the significance of the RV coefficient. Computational Statistics & Data Analysis, 53(1): 82–91.
See Also
Examples
drv( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
Distance correlation
Description
Distance correlation.
Usage
dcor(y, x, bc = FALSE)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
bc |
Do you want the corrected distance correlation? Default value if FALSE. |
Details
The distance correlation or the bias corrected distance correlation of two matrices is calculated. The latter one is used for the hypothesis test that the distance correlation is zero.).
Value
A list including:
dcov |
The (bias corrected) distance covariance. |
dvarX |
The (bias corrected) distance variance of x. |
dvarY |
The (bias corrected) distance variance of Y. |
dcor |
The (bias corrected) distance correlation. |
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr>.
References
G.J. Szekely, M.L. Rizzo and N. K. Bakirov (2007). Measuring and Testing Independence by Correlation of Distances. Annals of Statistics, 35(6): 2769–2794.
Szekely G. J. and Rizzo M. L. (2023). The energy of data and distance correlation. Chapman and Hall/CRC.
See Also
Examples
dcor( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
dcor( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]), bc = TRUE )
Mantel coefficient two sets of variables
Description
Mantel coefficient between two sets of variables.
Usage
mantel(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
The Mantel coefficient is simply the Pearson correlation coefficient computed on the off-diagonal elements of the distance matrix of each each matrix (or set of variables).
Value
The Mantel coefficient.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Abdi H. (2010). Congruence: Congruence coefficient, RV coefficient, and Mantel coefficient. Encyclopedia of Research Design, 3, 222–229.
See Also
Examples
mantel( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
Modified RV correlation between two sets of variables
Description
Modified RV correlation between two sets of variables.
Usage
mrv(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
The modified RV correlation coefficient
Value
The value of the modified RV coefficient.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Smilde A. K., Kiers H. A., Bijlsma S., Rubingh C. M. and Van Erk M. J. (2009). Matrix correlations for high-dimensional data: the modified RV-coefficient. Bioinformatics, 25(3): 401–405.
See Also
Examples
mrv( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
RV correlation between two sets of variables
Description
RV correlation between two sets of variables.
Usage
rv(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
The RV correlation coefficient
Value
The value of the RV coefficient.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
References
Robert P. and Escoufier Y. (1976). A Unifying Tool for Linear Multivariate Statistical Methods: The RV-Coefficient. Applied Statistics, 25(3): 257–265.
See Also
Examples
rv( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
Squared multivariate correlation between two sets of variables
Description
Squared multivariate correlation between two sets of variables.
Usage
sq.correl(y, x)
Arguments
y |
A numerical matrix. |
x |
A numerical matrix. |
Details
Mardia, Kent and Bibby (1979, pg. 171) defined two squared multiple correlation coefficient between the dependent variable \bf Y
and the independent variable \bf X
. They mention that these are a similar measure of the coefficient determination in the univariate regression. Assume that the multivariate regression model is written as {\bf Y}={\bf XB}+{\bf U}
, where \bf U
is the matrix of residuals. Then, they write {\bf D}=\left({\bf Y}^T{\bf Y}\right)^{-1}\hat{\bf U}^T\hat{\bf U}
, with \hat{\bf U}^T\hat{\bf U}={\bf Y}^T{\bf PY}
and \bf P
is {\bf P}={\bf I}_n-{\bf X}\left({\bf X}^T{\bf X}\right)^{-1}{\bf X}^T
. The matrix \bf D
is a generalization of 1-R^2
in the univariate case. Mardia, Kent and Bibby (1979, pg. 171) mentioned that the dependent variable \bf Y
has to be centred.
The squared multivariate correlation should lie between 0 and 1 and this property is satisfied by the trace correlation r_T
and the determinant correlation r_D
, defined as
r^2_T=d^{-1}\text{tr}\left({\bf I}-{\bf D}\right)
and r^2_D=\text{det}\left({\bf I}-{\bf D}\right)
respectively, where d
denotes the dimensionality of \bf Y
. So, high values indicate high proportion of variance of the dependent variables explained. Alternatively, one can calculate the trace and the determinant of the matrix {\bf E}=\left({\bf Y}^T{\bf Y}\right)^{-1}\hat{\bf Y}^T\hat{\bf Y}
. Try something else also, use the function "sq.correl()" in a univariate regression example and then calculate the R^2
for the same dataset. Try this example again but without centering the dependent variable. In addition, take two variables and calculate their squared correlation coefficient and then square it and using "sq.correl()".
Value
A vector with two values, the trace and determinant R^2
.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
See Also
Examples
sq.correl( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )