# How to find the appropriate family for glm models? [duplicate]

As suggested over at stackoverflow I poste the question here instead:

I have a data frame with three variables, where "Resp" is my response variable (count data), F1 is a categorical predictor (4 levels) and F2 is a continuous predictor. You can download the data from here: http://goo.gl/IRyVfw

head(DF,2)

F1       F2    Resp
1  B 11.184533 2416619
2  B  9.652227 1527579


The response variable is not normally distributed (although the square-root transformation looks ok) and it's integer count data, therefore I want to model it with glm().

My first question is: How can all predictors be (that!) highly significant (in the glm with the poisson family, see below). I even added a random variable and included it in the model and it was as significant as all the others! Can over dispersion cause this? I tested the over dispersion and it seems to be (highly) over dispersed so I tried the Gamma and quasi-poisson families. Fitting the model with a gamma family improves the AIC a lot and the significances seem much more reasonable. This is also true for the quasipoisson although gam() doesn't calculate AIC's for quasi-families.

So my main question is: How can I choose the appropriate family for my data? poisson was an intuitive choice for me (as it's count data, however very large ones), but it's likely to be an inappropriate choice here. Which other considerations should guide my decision?

the model with the poisson family:

GLM1 <- glm(Resp ~ F2 + F1, data=DF, family=poisson())

summary(GLM1)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-1030.94   -302.61    -38.35    200.96   1035.27

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)  1.371e+01  2.843e-04 48219.3   <2e-16 ***
F2           4.937e-02  1.752e-05  2817.5   <2e-16 ***
F1D         -1.495e-01  3.777e-04  -396.0   <2e-16 ***
F1L          4.485e-01  3.338e-04  1343.7   <2e-16 ***
F1S         -7.165e-02  3.728e-04  -192.2   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 21063189  on 47  degrees of freedom
Residual deviance:  8936211  on 43  degrees of freedom
AIC: 8936982

Number of Fisher Scoring iterations: 4
Over-dispersion test

library(AER)
rd <- glm(Resp ~ ., data = DF, family = poisson)
dispersiontest(rd,trafo=1)


Overdispersion test

data:  rd
z = 4.7806, p-value = 8.738e-07
alternative hypothesis: true alpha is greater than 0
sample estimates:
alpha
180138.9


the model with the Gamma family:

GLM2 <- glm(Resp ~ F2 + F1, data=DF, family=Gamma())

summary(GLM2)

Call:
glm(formula = Resp ~ F2 + F1, family = Gamma(), data = DF)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-1.35500  -0.30162   0.02438   0.19603   0.77093

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  9.472e-07  1.048e-07   9.038 1.69e-11 ***
F2          -2.044e-08  4.289e-09  -4.765 2.18e-05 ***
F1D          8.209e-08  1.461e-07   0.562   0.5770
F1L         -2.546e-07  1.222e-07  -2.084   0.0431 *
F1S          3.813e-08  1.437e-07   0.265   0.7920
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Gamma family taken to be 0.1831376)

Null deviance: 16.1836  on 47  degrees of freedom
Residual deviance:  9.6406  on 43  degrees of freedom
AIC: 1417.6

Number of Fisher Scoring iterations: 5


the model with the quasipoisson family:

GLM3 <- glm(Resp ~ F2 + F1, data=DF, family=quasipoisson())

summary(GLM3)

Call:
glm(formula = Resp ~ F2 + F1, family = quasipoisson(), data = DF)

Deviance Residuals:
Min        1Q    Median        3Q       Max
-1030.94   -302.61    -38.35    200.96   1035.27

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.708175   0.127484 107.529  < 2e-16 ***
F2           0.049374   0.007858   6.283 1.42e-07 ***
F1D         -0.149549   0.169361  -0.883  0.38214
F1L          0.448548   0.149693   2.996  0.00452 **
F1S         -0.071654   0.167188  -0.429  0.67036
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for quasipoisson family taken to be 201091.8)

Null deviance: 21063189  on 47  degrees of freedom
Residual deviance:  8936211  on 43  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 4

• When plotting the data using ggplot(DF, aes(x= F2, y= Resp)) + geom_point() + facet_wrap(~ F1) I see influential data points. If you look at the diagnostic plots of, e.g., GLM3 the "Residuals vs Leverage" plot also indicates this. – Roland Feb 11 '15 at 14:45
• sorry I meant GLM. I edited the title and the tag. I also agree that there are influential data points (although I don't think they are especial bad looking in the gamma model). But what implications does this have? Could you elaborate? – Latrunculia Feb 11 '15 at 14:51