I am working through McElreath's book on statistical rethinking. One of the problems is the following:

Using grid approximation, compute the posterior distribution for the probability of a birth being a boy. Assume a uniform prior probability. Which parameter value maximizes the posterior probability?

We are given 2 vectors, each of length 100. The components of each vector correspond to a particular family and takes on value 1 if the child is a boy and 0 if it's a girl. The first vector is for the first-born child for each family while the second vector is for the second-born child for each family.

To construct the likelihood, I consider each family as an independent sample. Within the family, the distribution of the sex of the children is binomial. Thus, if $p$ is the probability of being a boy, and $x_1,\dots,x_{100}$ represent the number of boys for each family, I get that the likelihood is $\binom{2}{x_1}p^{x_1}(1-p)^{2-x_1}\cdot\cdots\cdot \binom{2}{x_{100}}p^{x_{100}}(1-p)^{2-x_{100}}$.

I looked at the solutions and another approach considered was to pool the samples across all the families and consider it as a binomial distribution. The likelihood therefore is $\binom{200}{x_1+\dots +x_{100}} p^{x_1 + \dots + x_{100}} (1-p)^{200-(x_1 + \dots + x_{100})}$.

Mathematically, except for the constants, they're the same expression. (Or are the constants even equal?) From a modeling perspective, is there a difference between these 2 likelihoods? I'm surprised that the functional forms are almost the same.


1 Answer 1


This is an illustration of sufficiency in action within Bayesian statistics: when given a sample $x_1,\dots,x_{100}$ from a $\mathcal B(2,p)$ distribution, the posterior distribution of $p$ given that sample is the same as the posterior distribution of $p$ given the sum $$x_1+\cdots+x_{100}$$ because this sum is sufficient (meaning that the likelihood functions are proportional functions of $p$).


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.