Problem 9. Consider an observation from Y |N, p ∼ BiNom (N, p). This time, however,
both N and p are unkown. You observe y = 5 successes and assume the following prior:
p(N, p) = p(N)p(p) with N ∼ P (µ) and p ∼ B (a, b).2
(a) Fix the hyperparameters and explore the joint posterior p(N, p|y) and both marginal
posteriors p(N|y) and p(p|y), e.g. through grid evaluation.
(b) Under the improper prior p(N, p) ∝ 1/N, it holds that p(N|y) = y/(N(N + 1)) for
N ≥ y. What is the median of this distribution?