var_equation_vec: Solution to variance equation using vec

Description Usage Arguments Value Examples

View source: R/means_variances.R

Description

Solves for V in the equation V = A +LVL' using the fact that vec(V) = vec(A) + (L \kronecker L) vec(V). This may work when var_equation does not because L is not diagonalizable.

Usage

1

Arguments

A,L

matrices for which to find solution to V = A +LVL'

Value

v where V = A +LVL' if a solution exists

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
A <- diag(3) + .1
A
L <- cbind( c(.8,.1,.1), c(0, .7, .1), c(0,0,.6))
L
V <- var_equation_vec(A,L)
V
V - t(V)
V - A - L%*% V %*% t(L)  # should be machine 0
V - var_equation(A,L)
# L that can't be diagonalized
L <- cbind( c(.9,.1,0), c(0, .9, .1), c(0,0,.9))
var_equation(A,L)
var_equation_vec(A,L)
eigen(var_equation_vec(A,L))

gmonette/Tcells2 documentation built on May 14, 2017, 12:59 p.m.