Gaussian change-point Gibbs updates (source code)

= Gaussian change-point Gibbs updates
{c}

For independent means $\theta\sim N(\mu_\theta,t_\theta)$ and $\phi\sim N(\mu_\phi,t_\phi)$, the first mean's conditional precision is $m/v+1/t_\theta$ and conditional precision-weighted mean is $\sum_{i\le m}x_i/v+\mu_\theta/t_\theta$; replace $m$ by $n-m$ for the second mean. With $v\sim\operatorname{IG}(a_0,b_0)$ its conditional law is $\operatorname{IG}(a_0+n/2,b_0+S_m/2)$. The discrete split has conditional probabilities proportional to $e^{-S_m/(2v)}$. These <full conditional distributions> give a <Gibbs sampler> including $m=n$. Averaging the sampled indicators of that configuration estimates its <probability>; averaging its conditional probabilities gives an estimate by <Rao-Blackwellization>.