eigvaldisp-package | R Documentation |
This package involves functions for analyzing eigenvalue dispersion indices of covariance and correlation matrices, providing practical implementations for theoretical results of Watanabe (2022).
The DESCRIPTION file:
This package was not yet installed at build time.
Index: This package was not yet installed at build time.
Run vignettes("eigvaldisp")
for detailed descriptions and examples.
Junya Watanabe Junya.Watanabe@uab.cat
Watanabe, J. (2022) Statistics of eigenvalue dispersion indices: quantifying the magnitude of phenotypic integration. Evolution, 76, 4–28. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/evo.14382")}.
VE
: Calculate eigenvalue dispersion indices
Exv.VXX
: Moments of eigenvalue dispersion indices
AVar.VRR_xx
: Approximate variance of relative eigenvalue
variance of correlation matrix (internal functions)
VXXa
: “Bias-corrected” eigenvalue dispersion indices
Exv.VXXa
: Moments of “bias-corrected” eigenvalue dispersion
indices
simulateVE
: Simulate eigenvalue dispersion indices
GenCov
: Generate covariance/correlation matrix with
known structure
Exv.rx
: Moments of correlation coefficients (internal functions)
hgf
, sqrt_methods
, centering
,
digit
: Other internal utility functions
## Generate a population covariance matrix with known eigenvalues
Lambda <- c(4, 2, 1, 1)
(Sigma <- GenCov(evalues = Lambda, evectors = "random"))
all.equal(Lambda, eigen(Sigma)$values) # TRUE
## Calculate eigenvalue dispersion indices of this matrix
EDI_pop <- VE(S = Sigma)
## Population eigenvalue variance ("V(Sigma)") and
## relative eigenvalue variance ("Vrel(Sigma)"):
EDI_pop$VE
EDI_pop$VR
## Simulate a multivariate normal sample
N <- 20
X <- rmvn(N = N, Sigma = Sigma)
## Calculating eigenvalue dispersion indices from the sample
EDI_sam <- VE(X = X)
## Sample eigenvalue variance ("V(S)") and
## relative eigenvalue variance ("Vrel(S)")
EDI_sam$VE
EDI_sam$VR
## These are typically biased upward
## Expectation and sampling variance of eigenvalue variance
## ("E[V(S)]" and "Var[V(S)]")
## The argument n is for the degree of freedom, hence N - 1 in this case
(E_V_Sigma <- Exv.VES(Sigma = Sigma, n = N - 1))
(Var_V_Sigma <- Var.VES(Sigma = Sigma, n = N - 1))
## Same for relative eigenvalue variance ("E[Vrel(S)]", "Var[Vrel(S)]")
(E_Vrel_Sigma <- Exv.VRS(Sigma, N - 1))
(Var_Vrel_Sigma <- Var.VRS(Sigma, N - 1))
## Usually sample estimates are within a few S.D. away from the expectation:
(EDI_sam$VE - E_V_Sigma) / sqrt(Var_V_Sigma)
(EDI_sam$VR - E_Vrel_Sigma) / sqrt(Var_Vrel_Sigma)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.