Exact beta-binomial credibility with unequal exposures (source code)

= Exact beta-binomial credibility with unequal exposures
{title2=$Z=M/(M+\alpha+\beta)$}

For a common success chance with beta prior and conditionally independent binomial observations of sizes $m_i$, put $M=\sum_i m_i$ and $s=\sum_i x_i$. <Beta-binomial conjugacy> gives posterior mean $(\alpha+s)/(\alpha+\beta+M)$, equal to $Z(s/M)+(1-Z)\alpha/(\alpha+\beta)$. Multiplying by the next exposure predicts its expected count. The factor tends to one as exposure increases and to zero as prior concentration increases at fixed prior mean.