Consider this question and the working below:

A coin-making machine produces pennies. Each penny is manufactured to have a probability $P$ of turning up heads. However, the machine draws P randomly from the uniform distribution on [0,1] so $P$ can differ for each coin produced. A coin pops out of the machine. You flip it once, and it comes up heads. Given this information, what is the conditional distribution function or the probability of a head for that coin?

We have

$$P \sim U[0,1]$$

The probability distribution function:

$$f_P(p) = 1 \qquad (0\le p \le 1)$$

Let $X$ denote the random variable that the first toss is a head ($X=1$ in this case).

$$X|(P=p) \sim \text{Bernoulli}(p)$$

The probabiity mass function:

$$P(X=x|P=p) = p^x(1-p)^{1-x} \qquad (0\le p \le 1 \text{ and } x=0,1)$$

We need $f_{P|X}(p|x)$.

Get the joint distribution first:

$$P(X=x|P=p) = \frac{f_{X,P}(x,p)}{f_P(p)} \implies f_{X,P}(x,p) = P(X=x|P=p)f_P(p)$$ $$ f_{X,P}(x,p) = p^x(1-p)^{1-x} \qquad (0\le p \le 1 \text{ and } x=0,1)$$

I am not sure if this is the correct joint distribution? Is the relation I used to get it valid?


1 Answer 1


Using Bays $$P(P|H)P(H)=P(H|P)P(P)$$

Solving for P(P|H) $$P(P|H)=\frac{P(H|P)}{P(H)}*P(P)$$

Converting to distributions $$f_{P,X}(p|x=1)=\frac{P(H|P)}{P(H)}*f_P(p)$$

P(H|P) is just p, P(H) = 1/2, f_P(p) = 1 $$f_{P,X}(p|x=1)=\frac{p}{\frac{1}{2}}*f_P(p)$$


Checking, to find the Expected Value, E(P|H) $$E(P|H)=\int_0^1{p*f_P(p|H) dp}$$

$$E(P|H)=\int_0^1{p*2p dp}$$

$$E(P|H)=\int_0^1{2p^2 dp}$$

$$E(P|H)=\frac{2}{3}p^3|_{p=0}^{p=1} $$


This makes sense to me, at least :)

  • $\begingroup$ I think this is correct, but I want to understand where my approach is going wrong. Can you see why I am missing a factor of 2 in my question? $\endgroup$ Apr 15, 2016 at 21:26
  • $\begingroup$ Thanks! The factor of 2 comes from the a priori estimate of the probability of heads, a P(X=x) term. I think it should be on the lps on the second equation line after "get the joint distribution first." $\endgroup$
    – MikeP
    Apr 16, 2016 at 10:41
  • $\begingroup$ So are saying that $P(X=x|P=p)$ (in my notation) should have a 2? $\endgroup$ Apr 16, 2016 at 13:03
  • $\begingroup$ Actually, I may have messed up. I need to think on this a bit $\endgroup$
    – MikeP
    Apr 17, 2016 at 0:21
  • $\begingroup$ Sorry for the delay! Actually it's the $f_{X,P}(x,p)$ that needs the factor of 2, otherwise it won't integrate to 1 which is necessary for a valid pdf $\endgroup$
    – MikeP
    Apr 17, 2016 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.