0
$\begingroup$

I am trying to model count data using python's statsmodels module (Beer's sold at a football stadium as function of visitors, "tilskuer", and weather data).

model1 = smf.GLM(Y,Xall,sm.families.Poisson(sm.families.links.log)).fit()

Y is a count response, and Xall is a 20 x 5 data matrix (20 observations, 5 variables, X is shown below).

enter image description here

I get the results shown in the table below.

enter image description here

My first instinct was that this was decent, and that all the variables were significant. I looked at the QQ-plot which looks decent (from what I understand about it, shown below).

enter image description here

However, when I read a bit more about these things I found that for a Poisson model to correctly model the data (Variance = Mean) the Deviance/DF resid. should be approx. 1.

Mine is approx. 100.

So does this mean this model is completely off? Even though the QQ plot looks decent? Or how should I interpret this?

I tried using a negative binomial dist. instead.

model3 = smf.GLM(Y,Xall,family=sm.families.NegativeBinomial(sm.families.links.log)).fit()

This gave the opposite "error". Now the deviance is VERY small compared to DF Resid.

enter image description here

Ps. I want to add the variable "Tilskuer" as an offset, but can't seem to get smf.GML() to accept it in anyway (It makes the SVD composition "not converge").

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.