Compare matrices via Mantel Correlation
Calculates correlation matrix correlation and significance via Mantel test.
MantelCor(cor.x, cor.y, ...) ## Default S3 method: MantelCor( cor.x, cor.y, permutations = 1000, ..., landmark.dim = NULL, withinLandmark = FALSE, mod = FALSE ) ## S3 method for class 'list' MantelCor( cor.x, cor.y = NULL, permutations = 1000, repeat.vector = NULL, parallel = FALSE, ... ) ## S3 method for class 'mcmc_sample' MantelCor(cor.x, cor.y, ..., parallel = FALSE) MatrixCor(cor.x, cor.y, ...) ## Default S3 method: MatrixCor(cor.x, cor.y, ...) ## S3 method for class 'list' MatrixCor( cor.x, cor.y = NULL, permutations = 1000, repeat.vector = NULL, parallel = FALSE, ... ) ## S3 method for class 'mcmc_sample' MatrixCor(cor.x, cor.y, ..., parallel = FALSE)
cor.x |
Single correlation matrix or list of correlation matrices. If single matrix is suplied, it is compared to cor.y. If list is suplied and no cor.y is suplied, all matrices are compared. If cor.y is suplied, all matrices in list are compared to it. |
cor.y |
First argument is compared to cor.y. Optional if cor.x is a list. |
... |
aditional arguments passed to other methods |
permutations |
Number of permutations used in significance calculation. |
landmark.dim |
Used if permutations should be performed mantaining landmark structure in geometric morphomotric data. Either 2 for 2d data or 3 for 3d data. Default is NULL for non geometric morphomotric data. |
withinLandmark |
Logical. If TRUE within-landmark correlations are used in the calculation of matrix correlation. Only used if landmark.dim is passed, default is FALSE. |
mod |
Set TRUE to use mantel in testing modularity hypothesis. Should only be used in MantelModTest. |
repeat.vector |
Vector of repeatabilities for correlation correction. |
parallel |
if TRUE computations are done in parallel. Some foreach backend must be registered, like doParallel or doMC. |
If cor.x and cor.y are passed, returns matrix pearson correlation and significance via Mantel permutations.
If cor.x is a list of matrices and cor.y is passed, same as above, but for all matrices in cor.x.
If only cor.x is passed, a matrix of MantelCor average values and probabilities of all comparisons. If repeat.vector is passed, comparison matrix is corrected above diagonal and repeatabilities returned in diagonal.
If the significance is not needed, MatrixCor provides the correlation and skips the permutations, so it is much faster.
Diogo Melo, Guilherme Garcia
http://en.wikipedia.org/wiki/Mantel_test
c1 <- RandomMatrix(10, 1, 1, 10) c2 <- RandomMatrix(10, 1, 1, 10) c3 <- RandomMatrix(10, 1, 1, 10) MantelCor(cov2cor(c1), cov2cor(c2)) cov.list <- list(c1, c2, c3) cor.list <- llply(list(c1, c2, c3), cov2cor) MantelCor(cor.list) # For repeatabilities we can use MatrixCor, which skips the significance calculation reps <- unlist(lapply(cov.list, MonteCarloRep, 10, MatrixCor, correlation = TRUE)) MantelCor(cor.list, repeat.vector = reps) c4 <- RandomMatrix(10) MantelCor(cor.list, c4) #Multiple threads can be used with some foreach backend library, like doMC or doParallel #library(doParallel) ##Windows: #cl <- makeCluster(2) #registerDoParallel(cl) ##Mac and Linux: #registerDoParallel(cores = 2) #MantelCor(cor.list, parallel = TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.