# How Do I Calculate the Scaled Deviance of a GLM with Gamma(Exponential) Distributed Dependent Variable?

I'm fitting a generalized linear model to a theoretically exponentially distributed dataset. The exponential distribution has PDF $$f(y;\lambda) = \lambda e^{-\lambda y}$$ This question Deviance for Gamma GLM gives the "normal" deviance: $$2\sum_{i=1}^n -log(\frac{y_i}{\hat{\mu_i}}) + \frac{y_i-\hat{\mu_i}}{\hat{\mu_i}}$$ which can be very small (<1 when the model is a good fit). The scaled deviance is a modified deviance that is supposed to follow a chi-squared distribution with n-p degrees of freedom (where p is the number of model regressors). The formula I found gives that: $$\text{scaled deviance} = \frac{\text{deviance}}{\phi}$$ where $$\phi$$ is the scale parameter associated with the exponential distribution. Based on this question Is the canonical parameter (and therefore the canonical link function) for a Gamma not unique? the scale factor is 1, which would not change the scaled deviance compared to the normal deviance. What is the appropriate formula/scale parameter I should use here?

The relevant parameter of the exponential in a generalized linear model is $$\mu$$ (which is indeed a scale parameter); specifically we're dealing with the mean-parameterization of the exponential, of course, since GLMs are models for the conditional mean.

With a gamma GLM, the $$\phi$$ parameter is related to the shape parameter of the gamma distribution. It's estimated in the usual output for a Gamma glm.

In GLM terms, for the exponential, $$\phi=1$$. There's nothing to estimate.

If you want to use the gamma GLM to fit the exponential model and need inference or prediction, you need to make sure the software knows to use $$\phi=1$$*. (Some software might separate the exponential from the remaining gamma cases and take care of it itself.)

* For one example, this is straightforward in R. It is discussed in the help of the relevant functions - e.g. in summary.glm and anova.glm, the dispersion= argument does this -- by setting dispersion=1 in a gamma GLM, you have the corresponding results for an exponential GLM. Leaving dispersion unspecified results in it estimating it for a Gamma.

• Thanks for the explanation, I guess if this is the case, I'm really looking for the formula for scaled deviance here -- some alternative $\phi$ has to be used. Commented Apr 29 at 0:32
• If you change $\phi$ away from 1 you're not modelling with an exponential any more. Commented Apr 29 at 1:12