Package 'mvcor'

Title: Correlation Coefficients for Multivariate Data
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.
Authors: Michail Tsagris [aut, cre]
Maintainer: Michail Tsagris <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2024-11-15 06:23:49 UTC
Source: CRAN

Help Index


Correlation Coefficients for Multivariate Data

Description

Correlation Coefficients for Multivariate Data.

Details

Package: mvcor
Type: Package
Version: 1.0
Date: 2024-09-12
License: GPL-2

Maintainers

Michail Tsagris <[email protected]>.

Author(s)

Michail Tsagris [email protected]


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 [email protected].

References

Mordant G. and Segers J. (2022). Measuring dependence between random vectors via optimal transport. Journal of Multivariate Analysis, 189: 104912.

See Also

mrv, rv, drv, sq.correl, bcdcor

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 21RV(y,x)\sqrt{2}\sqrt{1-RV(y, x)}, where RV(y,x)RV(y,x)is the RV coefficient.

Value

The value of the dissimilarity.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris [email protected].

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

rv, sq.correl, bcdcor

Examples

drv( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )

Distance correlation

Description

Distance correlation.

Usage

dcor(y, x)
bcdcor(y, x)

Arguments

y

A numerical matrix.

x

A numerical matrix.

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

For the bias corrected distance correlation its value only. For the distance correlation a list including:

dcov

The distance covariance.

dvarX

The distance variance of x.

dvarY

The distance variance of Y.

dcor

The distance correlation.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <[email protected]>.

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.

See Also

sq.correl, rv

Examples

dcor( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )
bcdcor( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )

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 [email protected].

References

Abdi H. (2010). Congruence: Congruence coefficient, RV coefficient, and Mantel coefficient. Encyclopedia of Research Design, 3, 222–229.

See Also

rv, dcor

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 [email protected].

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

rv, arv, drv, sq.correl, bcdcor

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 [email protected].

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

mrv, drv, sq.correl, bcdcor

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 Y\bf Y and the independent variable X\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 Y=XB+U{\bf Y}={\bf XB}+{\bf U}, where U\bf U is the matrix of residuals. Then, they write D=(YTY)1U^TU^{\bf D}=\left({\bf Y}^T{\bf Y}\right)^{-1}\hat{\bf U}^T\hat{\bf U}, with U^TU^=YTPY\hat{\bf U}^T\hat{\bf U}={\bf Y}^T{\bf PY} and P\bf P is P=InX(XTX)1XT{\bf P}={\bf I}_n-{\bf X}\left({\bf X}^T{\bf X}\right)^{-1}{\bf X}^T. The matrix D\bf D is a generalization of 1R21-R^2 in the univariate case. Mardia, Kent and Bibby (1979, pg. 171) mentioned that the dependent variable Y\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 rTr_T and the determinant correlation rDr_D, defined as rT2=d1tr(ID)r^2_T=d^{-1}\text{tr}\left({\bf I}-{\bf D}\right) and rD2=det(ID)r^2_D=\text{det}\left({\bf I}-{\bf D}\right) respectively, where dd denotes the dimensionality of Y\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 E=(YTY)1Y^TY^{\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 R2R^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 R2R^2.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris [email protected].

See Also

rv, dcor

Examples

sq.correl( as.matrix(iris[, 1:2]), as.matrix(iris[, 3:4]) )