Hello.

Firstly, Dr. Plummer, I have to add my thanks to the chorus for your creation and support of `JAGS`

. **Thank you!**

I am working on a changepoint problem, and I want to create predictive values for the distributions pre- and post-changepoint. More specifically, if I have `N`

data points, I'd like to have an estimate for `N+1`

. A simple form of the model is below:

var N, X[N], CPP[N]; model { for (j in 1:N) { a[j] <- ifelse(year < m, alpha.prior[1], alpha.prior[2]) l[j] <- ifelse(year < m, lambda.prior[1], lambda.prior[2]) X[j] ~ dgamma(alpha[j], lambda[j]) } for (i in 1:2) { alpha.prior[i] ~ dgamma (0.5, 0.025) lambda.prior[i] <- pow(theta.prior[i], -1) theta.prior[i] ~ dgamma (0.5, 5.0E-4) } PreCP ~ dgamma(alpha.prior[1], lambda.prior[1]) PostCP ~ dgamma(alpha.prior[2], lambda.prior[2]) m ~ dcat(CPP) }

My intention is that `PreCP`

represents the distribution of the process prior to the changepoint and that `PostCP`

represents the process subsequent to the changepoint.

Am I correct in having `PreCP`

and `PostCP`

outside of the loop? Simply creating `X.rep[j] ~ dgamma(alpha[j], lambda[j])`

inside the loop will give predictions for each `j`

. When doing so, the `X.rep`

for the last `j`

does not have the distribution as `PostCP`

---close but not the same. For that matter creating an `X.rep2 ~ dgamma(alpha[2], lambda[2])`

which gives close, but non-identical, distributions for each `j`

is also not the same as `PostCP`

.

Are they all (at least for the last element of `j`

) really estimates of the same random variable and the difference is process risk, or is there a fundamental difference I am missing?

Once again, thank you very much.