Write down the model being fitted by the following R command, where y∈{0,1,2,…}n and X is an n×p matrix with real-valued entries.
fit <−glm(y∼X,family= poisson)
Write down the log-likelihood for the model. Explain why the command
sum(y)−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(μ) then
P(Z=k)=k!μke−μ
for k∈{0,1,2,…}.]