Solution (source code)

= Solution

For $\vartheta=(q,t)$ use the <estimating equation>
$$
\psi(Y,Z;\vartheta)=
\binom{Z-q}{ZY/q-(1-Z)Y/(1-q)-t}.
$$
Its empirical mean vanishes exactly at $(\widehat p,\widehat\tau)$. The population equation has the unique root $(p,\tau^*)$, so the <Z-estimator> is consistent. Linearizing the equation, or simplifying the corresponding sandwich covariance, gives the influence function
$$
\phi(Y,Z)
=\frac Zp(Y-\mu_1)-\frac{1-Z}{1-p}(Y-\mu_0).
$$
Hence
$$
\sqrt n(\widehat\tau-\tau^*)
\xrightarrow{d}N(0,V_{\mathrm{estimated}}),
\qquad
V_{\mathrm{estimated}}
=\frac{\operatorname{Var}(Y\mid Z=1)}p
+\frac{\operatorname{Var}(Y\mid Z=0)}{1-p}.
$$