Flat-prior elimination of a Gaussian common mean (source code)

= Flat-prior elimination of a Gaussian common mean

For independent observations $y_s\sim N(\beta+d_s,V_s)$, put $a_s=V_s^{-1}$, $S=\sum_sa_s$, $r_s=y_s-d_s$, $\bar r=S^{-1}\sum_sa_sr_s$ and $Q=\sum_sa_s(r_s-\bar r)^2$. Integrating the <likelihood function> against a flat <improper prior> on $\beta$ gives, up to the arbitrary prior constant,
$$
(2\pi)^{-(N-1)/2}S^{-1/2}\prod_sV_s^{-1/2}\exp(-Q/2).
$$
Indeed $\sum_sa_s(r_s-\beta)^2=Q+S(\beta-\bar r)^2$, and the remaining one-dimensional <Gaussian integral> is $\sqrt{2\pi/S}$. The conditional <Bayesian posterior> of $\beta$ is $N(\bar r,S^{-1})$.