Learn R Programming

evolqg (version 0.1-7)

SRD: Compare matrices via Selection Response Decomposition

Description

Based on Random Skewers tecnique, selection response vectors are expanded in direct and indirect componenet by trait and compared via vector correlations.

Usage

SRD(cov.x, cov.y, ...)

## S3 method for class 'default': SRD(cov.x, cov.y, iterations = 1000, ...)

## S3 method for class 'list': SRD(cov.x, cov.y = NULL, iterations = 1000, parallel = FALSE, ...)

## S3 method for class 'SRD': plot(x, matrix.label = "", ...)

Arguments

cov.x
Covariance matrix being compared. cov.x can be a matrix or a list.
cov.y
Covariance matrix being compared. Ignored if cov.x is a list.
...
aditional parameters passed to other methods
iterations
Number of random vectors used in comparison
parallel
if TRUE computations are done in parallel. Some foreach backend must be registered, like doParallel or doMC.
x
Output from SRD function, used in ploting
matrix.label
Plot label

Value

  • List of SRD scores means, confidence intervals, standard deviations, centered means e centered standard deviations

    pc1 scored along the pc1 of the mean/SD correlation matrix

    model List of linear model results from mean/SD correlation. Quantiles, interval and divergent traits

    cormat Mean/Sd model correlation matrix

Details

Output can be ploted using PlotSRD function

References

Marroig, G., Melo, D., Porto, A., Sebastiao, H., and Garcia, G. (2011). Selection Response Decomposition (SRD): A New Tool for Dissecting Differences and Similarities Between Matrices. Evolutionary Biology, 38(2), 225-241. doi:10.1007/s11692-010-9107-2

See Also

RandomSkewers

Examples

Run this code
cov.matrix.1 <- cov(matrix(rnorm(30*10), 30, 10))
cov.matrix.2 <- cov(matrix(rnorm(30*10), 30, 10))
colnames(cov.matrix.1) <- colnames(cov.matrix.2) <- sample(letters, 10)
rownames(cov.matrix.1) <- rownames(cov.matrix.2) <- colnames(cov.matrix.1)
srd.output <- SRD(cov.matrix.1, cov.matrix.2)

#lists
m.list <- RandomMatrix(10, 4)
srd.array.result = SRD(m.list)

#divergent traits
colnames(cov.matrix.1)[as.logical(srd.output$model$code)]

#Plot
plot(srd.output)

## For the array generated by SRD(m.list) you must index the idividual positions for plotting:
plot(srd.array.result[1,2][[1]])
plot(srd.array.result[3,4][[1]])

#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)
#SRD(m.list, parallel = TRUE)

Run the code above in your browser using DataLab