Solved – Invert a sparse covariance matrix

covariance-matrixlinear algebramatrix inversesparse

I have a postive definite symmetric covariance matrix which looks like this:
enter image description here

Note that all A,B,C,D,E,F,G are also poitive definite symmetric covariance matrices I want to find an easy way were I can invert the matrix in parts instead of inverting all of it at one time. I would really appreciate an R code or any method in R that can solve my problem
My main goal here is to find an efficient-fast way to invert this matrix and find its determinant

Best Answer

Could you make use of a simple block matrix inversion?

$$\left[\begin{array}{cc} A & B \\C & D \end{array}\right]^{-1}$$

$$=\begin{bmatrix} (A - BD^{-1}C)^{-1} & -A^{-1}B(D - CA^{-1}B)^{-1} \\ -D^{-1}C(A - BD^{-1}C)^{-1} & (D - CA^{-1}B)^{-1} \end{bmatrix}$$

(where here "$A$" would probably best correspond to your matrix with diagonal or block-diagonal $(A,B,C)$)

If your covariance is really an ordinary variance-covariance matrix, there are more suitable (but related) calculations. You might also consider some matrix decomposition, such as a Choleski, which would be greatly simplified by the particular structure you have.

--

usεr11852 makes an excellent point in comments; there are many situations where you don't really need to compute the inverse itself.

Related Question