dist.from.cov {rwc} | R Documentation |
Compute a squared distance matrix from a covariance matrix.
Description
This computes a squared distance matrix from a covariance matrix, or other positive semi-definite matrix. The resulting squared distance matrix is the variogram matrix or the resistance distance matrix under a random walk model for connectivity as in Hanks and Hooten (2013).
Usage
dist.from.cov(Sigma)
Arguments
Sigma |
A symmetric positive definite matrix. |
Value
A negative definite matrix of the same dimensions as Sigma.
Author(s)
Ephraim M. Hanks
References
Hanks and Hooten 2013. Circuit theory and model-based inference for landscape connectivity. Journal of the American Statistical Association. 108(501), 22-33.
Examples
## create a Wishart covariance matrix with independent structure
Z=matrix(rnorm(10*20),ncol=20,nrow=10)
W=Z %*% t(Z)
## convert to resistance distance matrix
D=dist.from.cov(W)
## convert back to covariance matrix
C=cov.from.dist(D)
## compare C and W
max(abs(C-W))
[Package rwc version 1.11 Index]