diag_Omegas: Simultaneously diagonalize two covariance matrices

Description Usage Arguments Details Value Warning References Examples

View source: R/matcal.R

Description

diag_Omegas Simultaneously diagonalizes two covariance matrices using eigenvalue decomposition.

Usage

1
diag_Omegas(Omega1, Omega2)

Arguments

Omega1

a positive definite (dxd) covariance matrix (d>1)

Omega2

another positive definite (dxd) covariance matrix

Details

See the return value and Muirhead (1982), Theorem A9.9 for details.

Value

Returns a length d^2 + d vector where the first d^2 elements are vec(W) with the columns of W being (specific) eigenvectors of the matrix Ω_2Ω_1^{-1} and the rest d elements are the corresponding eigenvalues "lambdas". The result satisfies WW' = Omega1 and Wdiag(lambdas)W' = Omega2.

If Omega2 is not supplied, returns a vectorized symmetric (and pos. def.) square root matrix of Omega1.

Warning

No argument checks! Does not work with dimension d=1!

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
d <- 2
W0 <- matrix(1:(d^2), nrow=2)
lambdas0 <- 1:d
(Omg1 <- W0%*%t(W0))
(Omg2 <- W0%*%diag(lambdas0)%*%t(W0))
res <- diag_Omegas(Omg1, Omg2)
W <- matrix(res[1:(d^2)], nrow=d, byrow=FALSE)
tcrossprod(W) # == Omg1
lambdas <- res[(d^2 + 1):(d^2 + d)]
W%*%diag(lambdas)%*%t(W) # == Omg2

saviviro/gmvarkit documentation built on Oct. 25, 2021, 2:14 a.m.