Notes

1  These data kindly provided by Peyton Cook.

2  The code for this model assumes that c06-math-1214 in the program are the three latent data values c06-math-1215, with c06-math-1216 [4] to c06-math-1217 [83] corresponding to the actual observations for 1909−1988. The code is

model { # outlier model for (t in 4:T + 3) { delta[t] ˜ dbern(Delta) eta[t] ˜ dnorm(0,tau.eta) o[t] <- eta[t]*delta[t]} Delta ˜ dbeta(1,19); tau.eta <- tau.G/10 # main model for (t in 4:T + 3) { y[t] ˜ dnorm(m[t],tau[t]) y.new[t] ˜ dnorm(m[t],tau[t]) e[t] <- pow(y[t]-y.new[t],2) # weights for scale mixture w[t] ˜ dgamma(nu.2,nu.2) tau[t] <- w[t]*tau.G; m[t] <- mu + o[t] + lambda*t + rho*(y[t-1]-o[t-1]) + phi[1]*(y[t-1]-y[t-2]) + phi[2]*(y[t-2]-y[t-3]) # log likelihood and inverse likelihood LL[t] <- 0.5*log(tau[t]/6.28)-0.5*tau[t] *pow(y[t]—m[t],2) # CPO estimated by inverse of posterior average of InvLk[] InvLk[t] <- 1/exp(LL[t])} # one step ahead predictions for (t in 5:T + 3) { m.p[t-1] <- m[t-1] + lambda y.one[t] ˜ dnorm(m.p[t-1],tau[t]) e2.one[t] <-pow(y[t]-y.one[t],2)} # assess stationarity NSTAT <- step(rho-1) # Predictive error E[1] <- sum(e2.one[5:T ...

Get Applied Bayesian Modelling, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.