Solution (source code)

= Solution

For each person, infection occurs with probability $\lambda$ and, conditional on infection, a GP visit occurs with probability $\rho_G$. Independent <Bernoulli thinning> therefore gives visit probability $\lambda\rho_G$. More explicitly, the <probability generating function> is
$$
\mathbb E[s^{Y_G}\mid N,\lambda,\rho_G]
=\bigl(1-\lambda+\lambda(1-\rho_G+\rho_Gs)\bigr)^N
=(1-\lambda\rho_G+\lambda\rho_Gs)^N.
$$
Thus
$$
Y_G\mid N,\lambda,\rho_G\sim
\operatorname{Binomial}(N,\lambda\rho_G),
$$
and the likelihood is
$$
\boxed{L_G(\lambda,\rho_G;y_G)
=\binom Ny_G(\lambda\rho_G)^{y_G}
(1-\lambda\rho_G)^{N-y_G}.}
$$