Defective coins

108 Views Asked by At

A machine that makes coins is flawed in the sense that it makes coins with a random bias. A coin is made by the machine has a probability P of landing Heads, where P is uniformly distributed in (0,1). We flip a coin that was made by this machine n times. Compute the mean and the variance of the number of heads we get in the n tosses.

As far as work goes, I have:

let H ~ Bin(n,P); P ~ U(0,1)

E(H) = E(E(H|P)) = E(n*P) = n * E(P) = n/2

Var(H|P) = ???

2

There are 2 best solutions below

0
On

$\begin{align} \mathsf{Var}(H) & = \mathsf{E}(\mathsf{Var}(H\mid P)) + \mathsf{Var}(\mathsf{E}(H\mid P)) \\[2ex] & = \mathsf E(nP(1-P)) + \mathsf {Var}(nP) \\[2ex] & = \int_0^1 \frac{np(1-p)}{2}\operatorname d p + \int_0^1 \frac 1 2\left(np-\frac n 2\right)^2\operatorname d p \end{align}$

0
On

Var(H) = E[Var(H|P)] + Var[E(H|P)]

edit: ninja'd