Finding the posterior PMF using Bayes Theorem

bayes-theorembayesiancombinatoricsprobabilitystatistics

The problem is as follows

Nefeli. a student in a probability class, takes a multiple-choice test with 10 questions and 3 choices per question. For each question. there are two equally likely possibilities, independent of other questions: either she knows the answer, in which case she answers the question correctly. or else she guesses the answer with probability of success $1/3$.

Given that Nefeli answered correctly 6 out of the 10 questions, what is the posterior PMF of the number of questions of which she knew the answer?

The textbook solution is as follows:

Let $K$ be the r.v. she knows the answer and $C$ be the r.v. she answers the question correctly
$$P(K|C) = \frac{P(C|K)P(K)}{P(C|K)P(K) + P(C|K^C)P(K^C)} = \frac{\frac{1}{2}}{\frac{1}{2} + \frac{1}{3}\frac{1}{2}} = \frac{3}{4}$$
The probability that Nefeli knows the answer to a question that she answered correctly is 3/4, so the posterior PMF is binomial with $n = 6$ and $p = 3/4$.

I decided I would try to approach this problem using Bayes Theorem, that is let $X$ be the r.v. for the number of questions correctly answered and $Y$ be the r.v. for the number of questions she knows the answers to. Thus we have:

$$p_{Y|X}(y|6) = \frac{p_{X|Y}(6|y)p_Y(y)}{p_X(6)}$$

$p_X(6)$ is the probability of answering 6 questions correctly which is just a binomial with $n=10$ and $p=P(C)=\frac{1}{2} + \frac{1}{3}\frac{1}{2} = \frac{2}{3}$:
$$\binom{10}{6}\left(\frac{2}{3}\right)^6\left(1-\frac{2}{3}\right)^4 $$

$p_Y(y)$ is the probability that she knows the answer for $y$ questions which is a binomial with $n=10$ and $p=\frac{1}{2}$
$$p_Y(y) = \binom{10}{y}\left(\frac{1}{2}\right)^y\left(1-\frac{1}{2}\right)^{10-y} $$

$p_{X|Y}(6|y)$ is the probability of answering 6 questions correctly given that she knows the answer for $y$ questions. This means that there will be $10-y$ questions to choose from and she will only need to answer $6-y$ more correctly with probability $P(C)$:
$$p_{X|Y}(6|y) = \binom{10-y}{6-y}\left(\frac{2}{3}\right)^{6-y}\left(1-\frac{2}{3}\right)^{10-6} $$

However, when I plug in say $y=3$ just to get a number for this result, it is not the same as the result I get from the book solution. Does anyone know what I may be doing wrong here? I seem to be off by a factor of 2, as in my answer is half the probability of the answer from the binomial with $n = 6$, $p = 3/4$, $k = 3$.

Best Answer

Correcting a small error in your last expression, you should have $$p_{X\mid Y}(6\mid y) = \binom{10-y}{6-y}\left(\frac{1}{3}\right)^{6-y}\left(1-\frac{1}{3}\right)^{10-6}$$

You then get $$p_{Y\mid X}(y\mid 6) = \frac{\binom{10-y}{6-y}\left(\frac{1}{3}\right)^{6-y}\left(1-\frac{1}{3}\right)^{10-6} \binom{10}{y}\left(\frac{1}{2}\right)^y\left(1-\frac{1}{2}\right)^{10-y}}{\binom{10}{6}\left(\frac{2}{3}\right)^6\left(1-\frac{2}{3}\right)^4}$$ and with cancellation this is $$=\frac{6!}{y!(6-y)!}\frac{3^y}{2^{12}} =\binom{6}{y}\left(\frac{3}{4}\right)^{y}\left(\frac{1}{4}\right)^{6-y} $$

Related Question