Solution (source code)

= Solution

Put $D_k=\sum_{i:z_i=k}d_i$ and $T_k=\sum_{i:z_i=k}x_i$. Since the cumulative hazard is $\theta e^{z_i\beta}x_i$,
$$
\ell(\theta,\beta)
=(D_0+D_1)\log\theta+D_1\beta
-\theta(T_0+e^\beta T_1).
$$
The score equations imply $D_1=\theta e^\beta T_1$ and $D_0=\theta T_0$. Therefore
$$
\widehat\theta=\frac{D_0}{T_0},
\qquad
\widehat\beta=log\frac{D_1/T_1}{D_0/T_0},
$$
when both event counts are positive, with the usual infinite boundary estimates otherwise.