Vivian Shih
2011-Dec-08 22:42 UTC
[R] Relationship between covariance and inverse covariance matrices
Hi,
I've been trying to figure out a special set of covariance
matrices that causes some symmetric zero elements in the inverse
covariance matrix but am having trouble figuring out if that is
possible.
Say, for example, matrix a is a 4x4 covariance matrix with equal
variance and zero covariance elements, i.e.
[,1] [,2] [,3] [,4]
[1,] 4 0 0 0
[2,] 0 4 0 0
[3,] 0 0 4 0
[4,] 0 0 0 4
Now if we let a[1,2]=a[2,1]=3, then the inverse covariance matrix
will have nonzero elements on the diagonals as well as for elements
[1,2] and [2,1]. If we further let a[3,4]=a[4,3]=0.5 then the indices
of the nonzero elements of the covariance matrix also matches those
indices of the inverse.
The problem is, if any of the nonzero off-diagonal indices match,
then the inverse covariance matrix will have non-matching nonzero
elements. For example, if a[1,2]=a[2,1]=3 as before but now we'll let
a[2,3]=a[3,2]=0.5, then a would be:
[,1] [,2] [,3] [,4]
[1,] 4 3.0 0.0 0
[2,] 3 4.0 0.5 0
[3,] 0 0.5 4.0 0
[4,] 0 0.0 0.0 4
The inverse covariance matrix is now:
[,1] [,2] [,3] [,4]
[1,] 0.58333333 -0.44444444 0.05555556 0.00
[2,] -0.44444444 0.59259259 -0.07407407 0.00
[3,] 0.05555556 -0.07407407 0.25925926 0.00
[4,] 0.00000000 0.00000000 0.00000000 0.25
If we let a[1,2] and a[2,3] be nonzero, then the inverse will
create a nonzero [1,3]. Does that happen all the time? I've tried to
write out the algebraic system of linear equations for a and a-inverse
but couldn't come up with anything.
Let me know if I'm not clear on anything. Basically I'd just like
to see what type of covariance matrices will produce an inverse
covariance matrix with some zero elements.
Thanks,
Vivian
Bert Gunter
2011-Dec-08 22:49 UTC
[R] Relationship between covariance and inverse covariance matrices
What does this have to do with R? Is this homework? I suggest you post to some sort of math list. Perhaps others will have more specific suggestions where. -- Bert On Thu, Dec 8, 2011 at 2:42 PM, Vivian Shih <vivs at ucla.edu> wrote:> Hi, > > ? I've been trying to figure out a special set of covariance matrices that > causes some symmetric zero elements in the inverse covariance matrix but am > having trouble figuring out if that is possible. > > ? Say, for example, matrix a is a 4x4 covariance matrix with equal variance > and zero covariance elements, i.e. > > ? ? [,1] [,2] [,3] [,4] > [1,] ? ?4 ? ?0 ? ?0 ? ?0 > [2,] ? ?0 ? ?4 ? ?0 ? ?0 > [3,] ? ?0 ? ?0 ? ?4 ? ?0 > [4,] ? ?0 ? ?0 ? ?0 ? ?4 > > ? ?Now if we let a[1,2]=a[2,1]=3, then the inverse covariance matrix will > have nonzero elements on the diagonals as well as for elements [1,2] and > [2,1]. If we further let a[3,4]=a[4,3]=0.5 then the indices of the nonzero > elements of the covariance matrix also matches those indices of the inverse. > > ? ?The problem is, if any of the nonzero off-diagonal indices match, then > the inverse covariance matrix will have non-matching nonzero elements. For > example, if a[1,2]=a[2,1]=3 as before but now we'll let a[2,3]=a[3,2]=0.5, > then a would be: > > ? ? [,1] [,2] [,3] [,4] > [1,] ? ?4 ?3.0 ?0.0 ? ?0 > [2,] ? ?3 ?4.0 ?0.5 ? ?0 > [3,] ? ?0 ?0.5 ?4.0 ? ?0 > [4,] ? ?0 ?0.0 ?0.0 ? ?4 > > ? ?The inverse covariance matrix is now: > ? ? ? ? ? ?[,1] ? ? ? ?[,2] ? ? ? ?[,3] [,4] > [1,] ?0.58333333 -0.44444444 ?0.05555556 0.00 > [2,] -0.44444444 ?0.59259259 -0.07407407 0.00 > [3,] ?0.05555556 -0.07407407 ?0.25925926 0.00 > [4,] ?0.00000000 ?0.00000000 ?0.00000000 0.25 > > ? ?If we let a[1,2] and a[2,3] be nonzero, then the inverse will create a > nonzero [1,3]. Does that happen all the time? I've tried to write out the > algebraic system of linear equations for a and a-inverse but couldn't come > up with anything. > > ? ?Let me know if I'm not clear on anything. Basically I'd just like to see > what type of covariance matrices will produce an inverse covariance matrix > with some zero elements. > > > > > > Thanks, > Vivian > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
Søren Højsgaard
2011-Dec-08 23:20 UTC
[R] Relationship between covariance and inverse covariance matrices
Your question is not all that R-related, but inverse covariance matrices with
zero entries corresponds to conditional independence restrictions in the
multivaritate normal distribution. Such inverse covariance matrices are key
ingredients in graphical Gaussian models (also known as covariance selection
models). You may want to study the litterature on such models.
Regards
S?ren
________________________________________
Fra: r-help-bounces at r-project.org [r-help-bounces at r-project.org]
På vegne af Vivian Shih [vivs at ucla.edu]
Sendt: 8. december 2011 23:42
Til: r-help at r-project.org
Emne: [R] Relationship between covariance and inverse covariance matrices
Hi,
I've been trying to figure out a special set of covariance
matrices that causes some symmetric zero elements in the inverse
covariance matrix but am having trouble figuring out if that is
possible.
Say, for example, matrix a is a 4x4 covariance matrix with equal
variance and zero covariance elements, i.e.
[,1] [,2] [,3] [,4]
[1,] 4 0 0 0
[2,] 0 4 0 0
[3,] 0 0 4 0
[4,] 0 0 0 4
Now if we let a[1,2]=a[2,1]=3, then the inverse covariance matrix
will have nonzero elements on the diagonals as well as for elements
[1,2] and [2,1]. If we further let a[3,4]=a[4,3]=0.5 then the indices
of the nonzero elements of the covariance matrix also matches those
indices of the inverse.
The problem is, if any of the nonzero off-diagonal indices match,
then the inverse covariance matrix will have non-matching nonzero
elements. For example, if a[1,2]=a[2,1]=3 as before but now we'll let
a[2,3]=a[3,2]=0.5, then a would be:
[,1] [,2] [,3] [,4]
[1,] 4 3.0 0.0 0
[2,] 3 4.0 0.5 0
[3,] 0 0.5 4.0 0
[4,] 0 0.0 0.0 4
The inverse covariance matrix is now:
[,1] [,2] [,3] [,4]
[1,] 0.58333333 -0.44444444 0.05555556 0.00
[2,] -0.44444444 0.59259259 -0.07407407 0.00
[3,] 0.05555556 -0.07407407 0.25925926 0.00
[4,] 0.00000000 0.00000000 0.00000000 0.25
If we let a[1,2] and a[2,3] be nonzero, then the inverse will
create a nonzero [1,3]. Does that happen all the time? I've tried to
write out the algebraic system of linear equations for a and a-inverse
but couldn't come up with anything.
Let me know if I'm not clear on anything. Basically I'd just like
to see what type of covariance matrices will produce an inverse
covariance matrix with some zero elements.
Thanks,
Vivian
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Maybe Matching Threads
- Sparse covariance estimation (via glasso) shrinking to a "nonzero" constant
- function for cumulative occurrence of elements
- Ordering every row of a matrix while ignoring off diagonal elements
- using SVD to get an inverse matrix of covariance matrix
- arima.sim problems (PR#3495)