Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

KrzProjection

Compare matrices via Modified Krzanowski Correlation


Description

Calculates the modified Krzanowski correlation between matrices, projecting the variance in each principal components of the first matrix in to the ret.dim.2 components of the second matrix.

Usage

KrzProjection(cov.x, cov.y, ...)

## Default S3 method:
KrzProjection(cov.x, cov.y, ret.dim.1 = NULL, ret.dim.2 = NULL, ...)

## S3 method for class 'list'
KrzProjection(
  cov.x,
  cov.y = NULL,
  ret.dim.1 = NULL,
  ret.dim.2 = NULL,
  parallel = FALSE,
  full.results = FALSE,
  ...
)

Arguments

cov.x

Single covariance matrix ou list of covariance matrices. If cov.x is a single matrix is suplied, it is compared to cov.y. If cov.x is a list of matrices is suplied and no cov.y is suplied, all matrices are compared between each other. If cov.x is a list of matrices and a single cov.y matrix is suplied, all matrices in list are compared to it.

cov.y

First argument is compared to cov.y. If cov.x is a list, every element in cov.x is projected in cov.y.

...

aditional arguments passed to other methods

ret.dim.1

number of retained dimensions for first matrix in comparison, default for nxn matrix is n/2-1

ret.dim.2

number of retained dimensions for second matrix in comparison, default for nxn matrix is n/2-1

parallel

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

full.results

if FALSE returns only total variance, if TRUE also per PC variance.

Value

Ratio of projected variance to total variance, and ratio of projected total in each PC

Author(s)

Diogo Melo, Guilherme Garcia

References

Krzanowski, W. J. (1979). Between-Groups Comparison of Principal Components. Journal of the American Statistical Association, 74(367), 703. doi:10.2307/2286995

See Also

Examples

c1 <- RandomMatrix(10)
c2 <- RandomMatrix(10)
KrzProjection(c1, c2)

## Not run: 
m.list <- RandomMatrix(10, 3)
KrzProjection(m.list)
KrzProjection(m.list, full.results = TRUE)
KrzProjection(m.list, ret.dim.1 = 5, ret.dim.2 = 4)
KrzProjection(m.list, ret.dim.1 = 4, ret.dim.2 = 5)

KrzProjection(m.list, c1)
KrzProjection(m.list, c1, full.results = TRUE)

## End(Not run)
#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)
#KrzProjection(m.list, parallel = TRUE)

evolqg

Tools for Evolutionary Quantitative Genetics

v0.2-8
MIT + file LICENSE
Authors
Ana Paula Assis, Diogo Melo, Edgar Zanella, Fabio Andrade Machado, Guilherme Garcia
Initial release
2020-11-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.