Paper 1, Section II, K

Statistical Modelling | Part II, 2014

Write down the model being fitted by the following R\mathrm{R} command, where y∈{0,1,2,…}ny \in\{0,1,2, \ldots\}^{n} and XX is an n×pn \times p matrix with real-valued entries.

fit <−glm⁡(y∼X,family=<-\operatorname{glm}(\mathrm{y} \sim \mathrm{X}, \mathrm{family}= poisson)

Write down the log-likelihood for the model. Explain why the command

sum⁡(y)−sum⁡(\operatorname{sum}(y)-\operatorname{sum}( predict (fit, type == "response" ))))

gives the answer 0, by arguing based on the log-likelihood you have written down. [Hint: Recall that if Z∼Pois⁡(μ)Z \sim \operatorname{Pois}(\mu) then

P(Z=k)=μke−μk!\mathbb{P}(Z=k)=\frac{\mu^{k} e^{-\mu}}{k !}

for k∈{0,1,2,…}k \in\{0,1,2, \ldots\}.]

Typos? Please submit corrections to this page on GitHub.