# Deviance in generalized linear models for different families

I'm a little confused by the deviance value returned by deviance(glm.model). I get quite different values for the same data fitted to different GLMs using family=Gamma(link=identity) (models 1/2) and gaussian(link=identity) (models 3/4).

> print(r)
Deviance      AIC
Model1   44.96093 2530.558
Model2   45.13543 2528.683
Model3 3028.56880 2487.124
Model2 3299.93121 2739.563


I read that there are several types of deviance calculated within glm() which I tried to see using:

> deviance(mod1)
 44.96093
> deviance(mod1,type="resp")
 44.96093
> deviance(mod1,type="dev")
 44.96093


which are all the same indicating to me the 'type=' is not the correct way to select them.

Could anyone tell me the right way to get comparable deviance values out of glm() for different families?

Thanks Chris

Here is the situation as I understand it: you can compare the general goodness of fit test across different GLM models if the dispersion parameter $\phi$ is known with certainty for the models you are comparing. With $\phi$ I mean the exponential family's dispersion parameter as used in this link.
So for Poisson (count regression) and Binomial (logistic regression) we know that $\phi=1$ and can thus legitimately compare fits on exactly the same data but with a different link function (a poisson and a count). But we cannot compare fits on that data using link function for the gamma, inverse gamma, gaussian, etc.
The reason is that the deviance (which is a likelihood ratio between a fully fitted model and your own model) is a function of the difference in estimates between the two models. But to get to the scaled deviance (which is $\chi^2$ distributed and makes the models comparable) we need to divide by $\phi$ which we do not always know.
I know this sounds odd when you know about F-tests for significance in nested GLMs using Deviance (whether they be gaussian or not) but with nested models the variance is estimated from the data and it is allowed for nested models of the same type on the same data. I have to say I cannot pin down for sure why it is allowed to estimate the dispersion here (my only guess is that across different link functions you cannot really quantify the variance of your $\hat{\phi}$). So OK to compare nested models, no matter what the link function.