# Posterior probability - change in Beta hyperparameters

Can you explain, how does $\text{B}(\alpha, \beta)$ transfrom to $\text{B}(s+\alpha, f+\beta)$ in the following equation?

\begin{align*} p(\left. q=x \right| s,f) &= {{{s+f \choose s} x^{s+\alpha-1}(1-x)^{f+\beta-1} / \operatorname{B}(\alpha,\beta)} \over \int_{y=0}^1 \left({s+f \choose s} y^{s+\alpha-1}(1-y)^{f+\beta-1} / \operatorname{B}(\alpha,\beta)\right) dy} \\ ~\\ ~\\ ~\\ ~\\ & = {x^{s+\alpha-1}(1-x)^{f+\beta-1} \over \operatorname{B}(s+\alpha,f+\beta)} \end{align*} (This equation is taken from Wikipedia's article on conjugate priors.)

However, I started an investigation from parameter estimation for text analysis by G. Heinrich (in that paper, equations 23 and 24).

I see, that in many papers, this is an "of course" statement, but I would be grateful for a derivation of the formula, or hints on how to do it on my own.

• Full reference for Heinrich paper please: are you expecting people to Google it themselves? – Nick Cox Aug 4 '13 at 14:38
• No math whatsoever is needed (which is why this is an "of course" result): notice that only the numerator depends on $x$ and that the $x$-dependence is accounted for entirely by the terms $x^{s+\alpha-1}(1-x)^{f+\beta-1}$ (whose values are defined and non-negative only for $0\le x\le 1$). Every bit of the rest is a constant and therefore has to equal the value needed to normalize the total probability to unity. Because a Beta distribution with parameters $s+\alpha, f+\beta$ is defined to have this form (up to the normalization constant), $q$ must be that Beta distribution. – whuber Aug 4 '13 at 15:32
• @diabel: Is my answer below acceptable, or are you looking for something else? – Tyler Streeter Aug 8 '13 at 12:26

In the equation:

\begin{align*} p(\left. q=x \right| s,f) &= \frac{ {s+f \choose s} x^{s+\alpha-1}(1-x)^{f+\beta-1} / \operatorname{B}(\alpha,\beta) }{ \int_{y=0}^1 \left({s+f \choose s} y^{s+\alpha-1}(1-y)^{f+\beta-1} / \operatorname{B}(\alpha,\beta)\right) dy } \\ &= \frac{ {s+f \choose s} x^{s+\alpha-1}(1-x)^{f+\beta-1} / \operatorname{B}(\alpha,\beta) }{ {s+f \choose s} \left( \int_{y=0}^1 y^{s+\alpha-1}(1-y)^{f+\beta-1} \, dy \right) / \operatorname{B}(\alpha \, \beta) } \\ &= \frac{ x^{s+\alpha-1}(1-x)^{f+\beta-1} }{ \int_{y=0}^1 y^{s+\alpha-1}(1-y)^{f+\beta-1} \, dy } \end{align*}

the denominator matches the form of the beta function:

$$\operatorname{B}(x,y) = \int_0^1 t^{x-1}(1-t)^{y-1} \, dt$$

so the denominator becomes:

$$\int_{y=0}^1 y^{s+\alpha-1}(1-y)^{f+\beta-1} \, dy = \operatorname{B}(s+\alpha,f+\beta)$$

and the original equation becomes:

$$p(\left. q=x \right| s,f) = \frac{ x^{s+\alpha-1}(1-x)^{f+\beta-1} }{ \operatorname{B}(s+\alpha,f+\beta) }$$