I came across a exercise on Bayesian inference with conjugate priors and MAP estimation:

When you pet your cat, she might scratch you with probability $p$ or start purring with probability $1-p$. You estimate prior on $p$ to be distributed as $Beta(2, 2)$. Within one evening, your cat has scratched you 6 times and only 2 times she purred. What will be the parameters for posterior distribution over $p$? What is the MAP-estimate for $p$?

My idea:

Prior: $P(p) = p^{2-1}(1-p)^{2-1} = p(1-p)$

Likelihood: $P(x|p) = p^6(1-p)^2$ (Bernoulli)

Posterior $P(p|x) \propto P(x|p)P(p) = p^6(1-p)^2p(1-p) = p^7(1-p)^3 = Beta(8,4)$

And for the MAP estimate: $\hat{p} = \underset{p}{\arg\max}~p^7(1-p)^3 = \frac{7}{10}$

Is this correct?

Edit: corrected error: Beta(6,2) -> Beta(8,4)

  • 2
    $\begingroup$ Does the exercise assume that cat either scratches or purrs (i.e. they are exclusive events)? Hint: you should end up with Beta(2+6, 2+2) distribution via conjugacy and the MAP is it's mode that has closed form solution $\endgroup$ – Tim May 20 '18 at 18:27
  • $\begingroup$ Yes, the cat either scratches or purrs. $\endgroup$ – cmplx96 May 20 '18 at 18:43
  • $\begingroup$ Thanks! I just realized I made a mistake: p^7(1-p)^3 is actually Beta(8,4), which is the same result that you gave $\endgroup$ – cmplx96 May 20 '18 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.