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 Ctk θk, φ Mtt) for t = 1, ..., T

where Ctk = Wtk / Wt+, Wt+ = Σk Wtk and Wtk = 1 if k = (t-1) or (t+1) and 0 otherwise; Mtt = 1/Wt+. 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 Ctk θk, φ Mtt) for t = 1, ..., T

where Ctk is defined as above, but this time with Wtk = -1 if k = (t-2) or (t+2), Wtk = 4 if k = (t-1) or (t+1) and t in (3, T-2), Wtk = 2 if k = (t-1) or (t+1) and t = 2 or T-1, Wtk = 0 otherwise; Mtt = 1/Wt+.

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).