Solution (source code)

= Solution

Before introduction there is no local infection exposure. Let $H=2024-2005=19$ years, using the actual elapsed time between introduction and sampling if exact dates are available. A lifelong resident aged $a_i$ has therefore had only
$$
e_i=\min(a_i,H)
$$
years of possible exposure. With a constant post-introduction <force of infection> $\lambda$, replace age by this exposure duration:
$$
\boxed{p_i=1-e^{-\lambda\min(a_i,19)},\qquad\operatorname{cloglog}(p_i)=\beta_0+\ln\min(a_i,19)}.
$$
Fit the same <binomial regression> with $\ln e_i$ as its <offset>. The predicted <seroprevalence> increases with age up to 19 and then reaches a plateau, since older residents all began local exposure at introduction.

This is equivalent to using a calendar-time <force of infection> of zero before 2005 and $\lambda$ afterwards. With a changing post-introduction rate, the more general exposure is $\int_{\max(2005,\,2024-a_i)}^{2024}\lambda(u)\,du$. Account separately for migration or infection acquired elsewhere, since current residence alone need not specify lifetime exposure. Subjects with exactly zero exposure have model probability zero and cannot be included by taking $\ln0$ as an ordinary finite <offset>; handle them through the original probability model.