DeltaZCorr: Compare matrices via the correlation between response vectors

View source: R/deltaZ_corr.R

DeltaZCorrR Documentation

Compare matrices via the correlation between response vectors

Description

Compares the expected response to selection for two matrices for a specific set of selection gradients (not random gradients like in the RandomSkewers method)

Usage

DeltaZCorr(cov.x, cov.y, skewers, ...)

## Default S3 method:
DeltaZCorr(cov.x, cov.y, skewers, ...)

## S3 method for class 'list'
DeltaZCorr(cov.x, cov.y = NULL, skewers, parallel = FALSE, ...)

Arguments

cov.x

Single covariance matrix or list of covariance matrices. If single matrix is supplied, it is compared to cov.y. If list is supplied and no cov.y is supplied, all matrices are compared. If cov.y is supplied, all matrices in list are compared to it.

cov.y

First argument is compared to cov.y. Optional if cov.x is a list.

skewers

matrix of column vectors to be used as gradients (k columns). A single vector is treated as a matrix with one column. Must have as many rows as the matrices have traits.

...

additional arguments passed to other methods.

parallel

if TRUE computations are done in parallel. Some foreach back-end must be registered, like doParallel or doMC.

Value

For two matrices, a vector with the correlation between the expected responses of the two matrices for each supplied vector, named with the column names of skewers.

For a list and a single matrix cov.y, a data.frame with one row per matrix in the list (and a .id column if the list is named) and one column per skewer.

For a list only (all pairwise comparisons): with one skewer, a list with the matrices correlations and probabilities, as in the other comparison methods (the probabilities are not defined for this method and are NA). With more than one skewer, an array of dimensions n x n x k, with dimnames (matrix names, matrix names, skewer names), where the correlation between matrices i and j (j > i) for each skewer is in [j, i, ]; the diagonal and upper triangle are 0.

Author(s)

Diogo Melo, Guilherme Garcia

References

Cheverud, J. M., and Marroig, G. (2007). Comparing covariance matrices: Random skewers method compared to the common principal components model. Genetics and Molecular Biology, 30, 461-469.

See Also

KrzCor,MantelCor,RandomSkewers

Examples

x <- RandomMatrix(10, 1, 1, 10)
y <- RandomMatrix(10, 1, 1, 10)

n_skewers = 10
skewers = matrix(rnorm(10*n_skewers), 10, n_skewers)
DeltaZCorr(x, y, skewers)

# all pairs in a list, one 10 x 10 matrix of correlations per skewer
DeltaZCorr(list(x, y, RandomMatrix(10)), skewers = skewers)


evolqg documentation built on Nov. 29, 2026, 1:08 a.m.

Related to DeltaZCorr in evolqg...