Solution (source code)

= Solution

Write $C$ for the binary response, $P$ for the partner count, and $Z$ for fully observed background variables. Let $R=(R_C,R_P)$ indicate which of $C,P$ are observed, with 1 meaning observed. For any realised pattern $r$, partition the data into $D_{\mathrm{obs}}(r)$ and $D_{\mathrm{mis}}(r)$.

<Missing completely at random> means that the <missing-data mechanism> does not depend on any of the measurements:
$$
\boxed{\Pr(R=r\mid C,P,Z)=\Pr(R=r).}
$$
<Missing at random> allows dependence on the data observed under the particular pattern, but no further dependence on its unobserved values:
$$
\boxed{\Pr(R=r\mid D_{\mathrm{obs}},D_{\mathrm{mis}})=\Pr(R=r\mid D_{\mathrm{obs}}).}
$$
Thus a response probability depending on fully observed age or sex can satisfy <missing at random>. Dependence on an observed partner count can also be permissible for patterns in which that count is available. <Missing not at random> means that this equality fails: the probability of the pattern still depends on one of its missing measurements, after conditioning on the observed ones. \b[The distinction concerns dependence on the unseen values, not whether missingness looks haphazard.] These definitions can be applied within the target population $P>1$; unknown membership of that population must itself be handled when $P$ is missing.