Temporal distributions
Temporal smoothing with car.normal
In one dimension, the intrinsic Gaussian CAR distribution reduces to a Gaussian random walk (see e.g.Fahrmeir and Lang, 2001). Assume we have a set of temporally correlated random effects
θt, t=1,..., T (where T is the number of equally-spaced time points). In the simplest case of a random walk of order 1, RW(1), we may write
θt |
θ-t ~ Normal
( θt+1,
φ ) for t = 1
~ Normal
( (θt-1 + θt+1)/2,
φ / 2 ) for t = 2, ...., T-1
~ Normal
( θt-1,
φ ) for t = T
where
θ-t denotes all elements of
θexcept the
θt. This is equivalent to specifying
θt |
θ-t ~ Normal
( Σk C
tk θk,
φ M
tt) for t = 1, ..., T
where C
tk = W
tk / W
t+, W
t+ =
Σk W
tk and W
tk = 1 if k = (t-1) or (t+1) and 0 otherwise; M
tt = 1/W
t+. Hence the RW(1) prior may be fitted using the
car.normal
distribution in WinBUGS, with appropriate specification of the weight and adjacency matrices, and num vector (see the
Air Pollution Example)
A second order random walk prior is defined as
θt |
θ-t ~ Normal
( 2
θt+1 - θt+2,
φ ) for t = 1
~ Normal
( (2
θt-1 + 4
θt+1 - θt+2)/5,
φ / 5 ) for t = 2
~ Normal
( (-θt-2 + 4
θt-1 + 4
θt+1 - θt+2)/6,
φ / 6 ) for t = 3, ...., T-2
~ Normal
( (-θt-2 + 4θt-1 + 2
θt+1)/5,
φ / 5 ) for t = T-1
~ Normal
( -θt-2+ 2
θt-1,
φ ) for t = T
Again this is equivalent to specifying
θt |
θ-t ~ Normal
( Σk C
tk θk,
φ M
tt) for t = 1, ..., T
where C
tk is defined as above, but this time with W
tk =
-1 if k = (t-2) or (t+2), W
tk = 4 if k = (t-1) or (t+1) and t in (3, T-2), W
tk = 2 if k = (t-1) or (t+1) and t = 2 or T-1, W
tk = 0 otherwise; M
tt = 1/W
t+.
Note that if the observed time points are not equally spaced, it is necessary to include missing values (NA) for the intermediate time points (see the
Air Pollution Example).