logdetAinvUpdate {estimateW} | R Documentation |
Efficient update of the log-determinant and the matrix inverse
Description
While updating the elements of the spatial weight matrix in SAR and SDM type spatial models in a MCMC sampler, the log-determinant term has to be regularly updated, too. When the binary elements of the adjacency matrix are treated unknown, the Matrix Determinant Lemma and the Sherman-Morrison formula are used for computationally efficient updates.
Usage
logdetAinvUpdate(ch_ind, diff, AI, logdet)
Arguments
ch_ind |
vector of non-negative integers, between 1 and |
diff |
a numeric |
AI |
numeric |
logdet |
single number that is the log-determinant of the matrix |
Details
Let A = (I_n - \rho W)
be an invertible n
by n
matrix. v
is an n
by 1
column vector of real numbers and u
is a binary vector containing a single one and zeros otherwise.
Then the Matrix Determinant Lemma states that:
A + uv' = (1 + v'A^{-1}u)det(A)
.
This provides an update to the determinant, but the inverse of A
has to be updated as well.
The Sherman-Morrison formula proves useful:
(A + uv')^{-1} = A^{-1} \frac{A^{-1}uv'A^{-1}}{1 + v'A^{-1}u}
.
Using these two formulas, an efficient update of the spatial projection matrix determinant can be achieved.
Value
A list containing the updated n
by n
matrix A^{-1}
, as well as the
updated log determinant of A
References
Sherman, J., and Morrison, W. J. (1950) Adjustment of an inverse matrix corresponding to a change in one element of a given matrix. The Annals of Mathematical Statistics, 21(1), 124-127.
Harville, D. A. (1998) Matrix algebra from a statistician's perspective. Taylor & Francis.