Math Help - Binomial with prior?

1. Binomial with prior?

Suppose $X$ ~ $Binomial(n,p)$ and the prior distribution for $p$ is $Beta(a,b).$

Find the mean and Variance of the marginal distribution.

2. I assume you want the marginal of X since the marginal of P is given (nice pun)

$E(X)=E(E(X|P))=E(nP)=nE(P)={na\over a+b}$

Next use....

$V(X)=E(V(X|P))+V(E(X|P))$

$=E(nP(1-P))+V(nP)=nE(P-P^2)+n^2V(P)$