Solution (source code)

= Solution

Write $f(y;\theta)=\exp\{y\theta-b(\theta)+c(y)\}$ and use canonical parameter $\theta_i=X_i^T\beta$. Then
$$
\ell(\beta)=\sum_i[Y_iX_i^T\beta-b(X_i^T\beta)+c(Y_i)],\quad X^T(Y-\mu)=0,
$$
where $\mu_i=b'(X_i^T\beta)$. Geometrically the residual <vector> is orthogonal to every design column. For $H_0:\beta_1=0$, use a two-sided Wald statistic $\hat\beta_1/\operatorname{se}(\hat\beta_1)$ (or likelihood-ratio statistic), rejecting at the corresponding normal or chi-square critical value.