= Solution
A <uniform prior> on $(0,T)$ makes the <posterior density> proportional to the <Poisson change-point posterior> likelihood above. The <zeros trick> introduces an observed zero with <Poisson distribution> mean $K-\log L(\theta)$, making its <likelihood function> equal to $e^{-K}L(\theta)$. Choose $K=T+n\log2+1$; since $\log L(\theta)\le n\log2$, this mean is strictly positive. Rough <BUGS> code, with `zero=0` supplied as data, is
``
model {
theta ~ dunif(0,T)
for (i in 1:n) {
before[i] <- step(theta-time[i])
}
j <- sum(before[])
logL <- theta-2*T+(n-j)*log(2)
zero ~ dpois(K-logL)
}
``
For $n=0$, omit the array and set `j <- 0`. Monitor the sampled `theta` to obtain its <posterior mean>, <credible interval> and interval probabilities.
There is also an exact sampling method. On $(t_j,t_{j+1})$ the <posterior density> is proportional to $2^{-j}e^\theta$, so choose the interval with weights
$$
w_j=2^{-j}(e^{t_{j+1}}-e^{t_j}),\qquad j=0,\ldots,n.
$$
Then draw $U$ from a <uniform distribution> on $(0,1)$ and set $\theta=\log(e^{t_j}+U(e^{t_{j+1}}-e^{t_j}))$. \b[These weighted interval draws sample the posterior directly], without asking a local <Markov chain Monte Carlo> update to cross its discontinuities.
Back to article page