# Expectance of predictive posterior on binomial-beta modeling

I'm struggle with figuring out how to prove:

$$E(\tilde{x}|x)=n\frac{a1}{a1+b1}$$

where $$x|\theta \sim Bin(n,\theta)$$, $$\theta \sim Beta(\alpha,\beta)$$ and so $$\theta|x\sim Beta(a_1=\sum{x_i}+\alpha,a_2=n.N-\sum_{}x_i+\beta)$$ ($$N$$ as sample size)

I tried:

$$p(\tilde{x}|x)=\displaystyle\int_{\theta}p(\tilde{x}|\theta)f(\theta|x)d\theta$$

$$p(\tilde{x}|\theta)=\displaystyle\frac{n!}{\tilde{x}!(n-\tilde{x})!}\theta^{\tilde{x}}(1-\theta)^{n-\tilde{x}}$$

$$f(\theta|x)=\displaystyle\frac{1}{B(\sum x_i+\alpha, n.N-\sum x_i + \beta)}\theta^{\sum x_i+\alpha-1 }(1-\theta)^{n.N-\sum x_i +\beta -1}$$

so

$$p(\tilde{x}|x)\propto \displaystyle\frac{n!}{\tilde{x}!(n-\tilde{x})!}\displaystyle\int_{\theta} \theta^{\tilde{x}+\sum x_i +\alpha -1}(1-\theta)^{n-\tilde{x}+n.N-\sum x_i +\beta -1}d\theta$$

$$p(\tilde{x}|x)\propto \displaystyle\frac{n!}{\tilde{x}!(n-\tilde{x})!}B(\tilde{x}+\sum x_i +\alpha, n-\tilde{x}+n.N-\sum x_i +\beta)$$

I don't know what that distribution is so I've explicited the formula:

$$p(\tilde{x}|x)=\displaystyle\frac{n!}{\tilde{x}!(n-\tilde{x})!}\frac{B(\tilde{x}+\sum x_i +\alpha, n-\tilde{x}+n.N-\sum x_i +\beta)}{B(\sum x_i +\alpha, n.N-\sum x_i +\beta)}$$

so:

$$E(\tilde{x}|x)=\displaystyle\sum_{\tilde{x}=1}^{n}\tilde{x}\displaystyle\frac{n!}{\tilde{x}!(n-\tilde{x})!}\frac{B(\tilde{x}+\sum x_i +\alpha, n-\tilde{x}+n.N-\sum x_i +\beta)}{B(\sum x_i +\alpha, n.N-\sum x_i +\beta)}$$

Making some math I got:

$$E(\tilde{x}|x)=\displaystyle\sum_{\tilde{x}=1}^{n}\frac{1}{B(\tilde{x},n-\tilde{x}+1)}\frac{B(\tilde{x}+\sum x_i +\alpha, n-\tilde{x}+n.N-\sum x_i +\beta)}{B(\sum x_i +\alpha, n.N-\sum x_i +\beta)}$$

So here is the question:

1- Is the $$\tilde{x}$$ support the same as $$x|\theta$$ support?

2- if so then how to solve this summation?

There's a simpler way to tackle it, using the Law of Iterated Expectations. For notational clarity, I will define $$y$$ as "future $$x$$", so your first line would be $$\mathbb{E}(y|x) = \dots$$. Writing out the Law as applied to this case gives us:

$$\mathbb{E}[y|x] = \mathbb{E}_{\theta | x} \mathbb{E}[y|\theta]$$

We have $$\mathbb{E}[y|\theta] = n\theta$$. Taking the expectation of this with respect to $$\theta | x$$ gives us:

$$\mathbb{E}[y|x] = n\mathbb{E}[\theta | x] = n {a_1 \over a_1 + b_1}$$

The derivation of $$a_1$$ and $$b_1$$ as parameters of the posterior $$p(\theta | x)$$ I believe you have done above, although the Latex formatting seems not to be 100% correct in the relevant section at the time of this writing.

• $E(y|x)=E(E(y|\theta)|x)=E(n.\theta|x)=nE(\theta|x)$, Great my friend, Ive seen this theorem before but not for $y|x$. Thank you so much. Nov 28, 2021 at 9:23
• Could you tell me if both supports are the same? Nov 28, 2021 at 22:51
• Yes, they are. The Law doesn't change that relative to working it out by hand the long way Nov 29, 2021 at 2:01