@@ -99,35 +99,39 @@ the set of full conditional distributions by
9999introducing a fixed point from the support of $p$
100100and then using Brook’s Lemma to factor the set of conditional distributions
101101into a joint distribution which is determined up to a proportionality constant
102- (see Banerjee, Carlin, and Gelfand, 2004, sec. 3.2):
102+ (see Banerjee, Carlin, and Gelfand, 2004, sec. 3.2) as a Gaussian with mean and precision parameters :
103103
104104$$ \mathbf{\phi} \sim \mathit{N} \left(\mathbf{0}, \left[D_{\tau}(I - \alpha B)\right]^{-1} \right) $$
105105
106106where
107107
108+ - $W$ is the $n \times n$ adjacency matrix where entries $\{ i,i\} $ are zero and the off-diagonal elements
109+ are $1$ if regions $i$ and $j$ are neighbors and $0$ otherwise.
110+ - $D$ is the $n \times n$ diagonal where entries $\{ i,i\} $ are the number of neighbors of region $i$
111+ and the off-diagnoal entries are $0$.
112+ - $D_ {\tau} = \tau D$
108113- $\alpha$ is between 0 and 1
109- - $B$ is the $n \times n$ matrix weights matrix $W$ where entries $\{ i,i\} $ are zero and the off-diagonal elements
110- describe the spatial proximity of regions $i$ and $j$
114+ - $B$ is the scaled adjacency matrix $D^{-1}W$
111115- $I$ is an $n \times n$ identity matrix
112- - $D_ {\tau} = \tau D$ where $D$ is an $n \times n$ diagonal matrix
113116
114- The construction of the spatial proximity matrix $B$ determines the class of CAR model structure.
115-
116- In the case where $B$ is a positive definite matrix, then the CAR model structure is a fully generative model.
117- However evaluation of the joint distribution requires computing the covariance matrix described by
118- $[ D_ {\tau}(I - \alpha B)] ^{-1}$, which is computationally expensive.
117+ Since $D_ {\tau} = \tau D$ and $B = D^{-1}W$, $[ D_ {\tau}(I - \alpha B)] ^{-1}$
118+ rewrites to $[ {\tau}(D - \alpha W)] ^{-1}$.
119+ In the case where $\alpha < 0$, the precision matrix is positive definite,
120+ thus the joint distribution is proper.
121+ However evaluation of the joint distribution requires computing the determinant of this matrix,
122+ which is computationally expensive.
119123See the Stan case study
120124[ Exact sparse CAR models in Stan] ( http://mc-stan.org/documentation/case-studies/mbjoseph-CARStan.html ) ,
121- for further discussion of CAR models .
125+ for discussion of how to speed up computation .
122126
123127### Intrinsic Conditional Auto-Regressive (ICAR) models
124128
125- An Intrinsic Conditional Auto-Regressive (ICAR) model is a CAR model where:
129+ An Intrinsic Conditional Auto-Regressive (ICAR) model is a CAR model where $\alpha = 1$,
130+ so that the joint distribution simplifies to,
131+
132+ $$ \phi \sim N(0, [\tau \, (D - W)]^{-1}). $$
126133
127- - $\alpha = 1$
128- - $D$ is an $n \times n$ diagonal matrix where $d_ {i,i}$ = the number of neighbors for region $n_i$
129- - $B$ is the scaled weights matrix $W / D$, where $W$ is uses a binary encoding such that
130- $w_ {i,i} = 0, w_ {i,j} = 1$ if $i$ is a neighbor of $j$, and $w_ {i,j}=0$ otherwise
134+ resulting in a singular precision matrix and an improper prior distribution.
131135
132136The corresponding conditional distribution specification is:
133137
@@ -140,11 +144,7 @@ which has a set of neighbors $j \neq i$ whose cardinality is $d_{i,i}$,
140144is normally distributed with a mean equal to the average of its neighbors.
141145Its variance decreases as the number of neighbors increases.
142146
143- The joint distribution simplifies to:
144-
145- $$ \phi \sim N(0, [\tau \, (D - W)]^{-1}). $$
146-
147- which rewrites to the _ pairwise difference_ formulation:
147+ The joint distribution, above, rewrites to the _ pairwise difference_ formulation:
148148
149149$$ p(\phi | \tau) \propto {\tau}^{\frac{n - NC}{2}} \exp \left\{ {- \frac{\tau}{2}} \sum_{i \sim j}{({\phi}_i - {\phi}_j)}^2 \right\} $$
150150
@@ -543,7 +543,7 @@ The R script
543543[ fit_scotland_bugs.R] ( https://github.com/stan-dev/example-models/tree/master/knitr/car-iar-poisson/fit_scotland_bugs.R )
544544uses OpenBUGS to fit this model.
545545
546- ``` {r fit-scotland-bugs, echo = FALSE, results = FALSE }
546+ ``` {r fit-scotland-bugs, echo = FALSE, results = FALSE, eval=FALSE }
547547library(R2OpenBUGS);
548548library(rstan)
549549
@@ -592,7 +592,7 @@ sims = rstan::monitor(fit_bugs$sims.array,
592592 probs=c(0.025, 0.975), warmup=0, print=TRUE);
593593```
594594
595- ``` {r print-fit-scotland-bugs }
595+ ``` {r print-fit-scotland-bugs, eval=FALSE }
596596options(digits=2);
597597sims[1:10, 1:7];
598598```
0 commit comments