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 be an invertible
by
matrix.
is an
by
column vector of real numbers and
is a binary vector containing a single one and zeros otherwise.
Then the Matrix Determinant Lemma states that:
.
This provides an update to the determinant, but the inverse of has to be updated as well.
The Sherman-Morrison formula proves useful:
.
Using these two formulas, an efficient update of the spatial projection matrix determinant can be achieved.
Value
A list containing the updated by
matrix
, as well as the
updated log determinant of
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.