car_precision {stcos} | R Documentation |
CAR Precision Matrix
Description
A convenience function to compute the CAR precision matrix based on a given adjacency matrix.
Usage
car_precision(A, tau = 1, scale = FALSE)
Arguments
A |
An adjacency matrix. |
tau |
The CAR dependency parameter |
scale |
Whether to scale matrix entries. See "Value".
Default: |
Details
Suppose \bm{A}
is an n \times n
adjacency matrix and
\bm{D} = \textrm{Diag}(\bm{A} \bm{1})
= \textrm{Diag}(a_{1+}, \ldots, a_{n+}).
If scale
is FALSE
, return the CAR precision matrix
\bm{Q} = \bm{D} - \tau \bm{A}.
If scale
is TRUE
, return a scaled version
\tilde{\bm{Q}} = \bm{D}^{-1} \bm{Q}.
An error is thrown if scale = TRUE
and any of
\{ a_{1+}, \ldots, a_{n+} \}
are equal to 0.
Taking \tau = 1
corresponds to the Intrinsic CAR
precision matrix.
Typically in a modeling context, the precision matrix will be
multiplied by a scaling parameter; e.g., a CAR model for
random effects \bm{\phi}
could be
f(\bm{\phi} \mid \alpha) \propto
\alpha^{-q} \exp\left\{ -\frac{1}{2 \alpha^2}
\bm{\phi}^\top \bm{Q} \bm{\phi} \right\}.
where q = \textrm{rank}(Q)
.
Value
CAR precision matrix.
Examples
data("acs_sf")
dom = acs5_2013[1:4,]
A = adjacency_matrix(dom)
Q = car_precision(A)