redecompose_Omegas {sstvars}R Documentation

In the decomposition of the covariance matrices (Muirhead, 1982, Theorem A9.9), change the ordering of the covariance matrices.

Description

redecompose_Omegas exchanges the order of the covariance matrices in the decomposition of Muirhead (1982, Theorem A9.9) and returns the new decomposition.

Usage

redecompose_Omegas(M, d, W, lambdas, perm = 1:M)

Arguments

M

the number of regimes in the model

d

the number of time series in the system

W

a length d^2 vector containing the vectorized W matrix.

lambdas

a length d*(M-1) vector of the form \lambda_{2},...,\lambda_{M} where \lambda_{m}=(\lambda_{m1},...,\lambda_{md})

perm

a vector of length M giving the new order of the covariance matrices (relative to the current order)

Details

We consider the following decomposition of positive definite covariannce matrices: \Omega_1 = WW', \Omega_m = W\Lambda_{m}W', m=2,..,M where \Lambda_{m} = diag(\lambda_{m1},...,\lambda_{md}) contains the strictly postive eigenvalues of \Omega_m\Omega_1^{-1} and the column of the invertible W are the corresponding eigenvectors. Note that this decomposition does not necessarily exists for M > 2.

See Muirhead (1982), Theorem A9.9 for more details on the decomposition and the source code for more details on the reparametrization.

Value

Returns a d^2 + (M - 1)d \times 1 vector of the form c(vec(new_W), new_lambdas) where the lambdas parameters are in the regimewise order (first regime 2, then 3, etc) and the "new W" and "new lambdas" are constitute the new decomposition with the order of the covariance matrices given by the argument perm. Notice that if the first element of perm is one, the W matrix will be the same and the lambdas are just re-ordered.

Note that unparametrized zero elements ARE present in the returned W!

Warning

No argument checks! Does not work with dimension d=1 or with only one mixture component M=1.

References

Examples

# Create two (2x2) coviance matrices:
d <- 2 # The dimension
M <- 2 # The number of covariance matrices
Omega1 <- matrix(c(2, 0.5, 0.5, 2), nrow=d)
Omega2 <- matrix(c(1, -0.2, -0.2, 1), nrow=d)

# The decomposition with Omega1 as the first covariance matrix:
decomp1 <- diag_Omegas(Omega1, Omega2)
W <- matrix(decomp1[1:d^2], nrow=d, ncol=d) # Recover W
lambdas <- decomp1[(d^2 + 1):length(decomp1)] # Recover lambdas
tcrossprod(W) # = Omega1
W%*%tcrossprod(diag(lambdas), W) # = Omega2

# Reorder the covariance matrices in the decomposition so that now
# the first covariance matrix is Omega2:
decomp2 <- redecompose_Omegas(M=M, d=d, W=as.vector(W), lambdas=lambdas,
                              perm=2:1)
new_W <- matrix(decomp2[1:d^2], nrow=d, ncol=d) # Recover W
new_lambdas <- decomp2[(d^2 + 1):length(decomp2)] # Recover lambdas
tcrossprod(new_W) # = Omega2
new_W%*%tcrossprod(diag(new_lambdas), new_W) # = Omega1

[Package sstvars version 1.0.1 Index]