Normal mean-variance posterior with a log-uniform variance prior (source code)

= Normal mean-variance posterior with a log-uniform variance prior

For iid $N(\mu,v)$ observations, the prior density $1/v$ relative to $d\mu\,dv$ gives posterior kernel $v^{-n/2-1}\exp[-\{S+n(\mu-\bar x)^2\}/(2v)]$. It is proper exactly when $n>1$ and $S=\sum(x_i-\bar x)^2>0$. The conditionals are $\mu\mid v,x\sim N(\bar x,v/n)$ and $v\mid\mu,x\sim\operatorname{IG}(n/2,\sum_i(x_i-\mu)^2/2)$. Integrating out $\mu$ changes the inverse-gamma shape to $(n-1)/2$.