eigvaldisp-package: eigvaldisp: Statistics of Eigenvalue Dispersion Indices

eigvaldisp-packageR Documentation

eigvaldisp: Statistics of Eigenvalue Dispersion Indices

Description

This package involves functions for analyzing eigenvalue dispersion indices of covariance and correlation matrices, providing practical implementations for theoretical results of Watanabe (2022).

Details

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.

Author/Maintainer

Junya Watanabe Junya.Watanabe@uab.cat

References

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")}.

See Also

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

Examples

## 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)


watanabe-j/eigvaldisp documentation built on Dec. 8, 2023, 4:38 a.m.