Q32. Deriving the Poisson log-likelihood
[3 marks]
Suppose, conditional on fixed covariates, Y_i\mid\mathbf X_i \overset{\mathrm{ind}}{\sim}\operatorname{Poisson}(\mu_i), \qquad \mu_i=\exp(\mathbf X_i^\top\boldsymbol\beta). Starting from the Poisson probability mass function, show that \ell(\boldsymbol\beta) =\sum_{i=1}^{n}\left[ Y_i\mathbf X_i^\top\boldsymbol\beta -\exp(\mathbf X_i^\top\boldsymbol\beta) \right]+C. State exactly what C contains and why it can be ignored when maximising over \boldsymbol\beta.
Definitions. Let \mathbf X_i be a fixed column vector of predictors and X the matrix with rows \mathbf X_i^\top. Write \eta_i=\mathbf X_i^\top\boldsymbol\beta and \mu_i=e^{\eta_i}. The likelihood is the joint Poisson mass function evaluated at observed counts \mathbf y, and \ell=\log L. An additive constant may depend on the data but not on the parameter \boldsymbol\beta being maximised over.
For observed counts y_i\in\{0,1,2,\ldots\}, \mathbb{P}(Y_i=y_i\mid\mathbf X_i) =\frac{e^{-\mu_i}\mu_i^{y_i}}{y_i!}, \qquad \mu_i=\exp(\mathbf X_i^\top\boldsymbol\beta). Conditional independence gives L(\boldsymbol\beta;\mathbf y,X) =\prod_{i=1}^n\frac{e^{-\mu_i}\mu_i^{y_i}}{y_i!}. Taking logarithms, \ell(\boldsymbol\beta) =\sum_{i=1}^n\{-\mu_i+y_i\log\mu_i-\log(y_i!)\}. Since \log\mu_i=\mathbf X_i^\top\boldsymbol\beta, this becomes \boxed{ \ell(\boldsymbol\beta) =\sum_{i=1}^n \left[y_i\mathbf X_i^\top\boldsymbol\beta -\exp(\mathbf X_i^\top\boldsymbol\beta)\right]+C, \quad C=-\sum_{i=1}^n\log(y_i!). } The constant C depends only on the observed responses, not on \boldsymbol\beta. Therefore adding or removing it does not change the maximiser over \boldsymbol\beta, and its derivatives with respect to \boldsymbol\beta are zero. Writing Y_i instead of y_i gives the random-data version in the question.
Key result. “Constant” means constant with respect to the parameter being optimised, not necessarily independent of the data.