To get Exponential GLM, you can do:

fit = glm(formula =..., family = Gamma)

summary(fit, dispersion=1)

But how do you get the fitted values, prediction using new data, and Pearson's residuals easily? I used to do fitted.values(fit), predict(fit, newdata, type = 'response'), and residual(fit, type = 'pearson') after fitting a GLM as the object fit. But this isn't fitting an Exponential GLM to the object fit...

  • 2
    $\begingroup$ This appears to be a question only about how to use these R functions (& hence off topic here). $\endgroup$ Dec 7, 2016 at 22:08
  • 1
    $\begingroup$ @gung I believe there's an underlying statistical issue to explain here. This question could be modified to reflect that aspect and some of the present question relating to R functionality is then partly moot -- the remainder could be posted as a new question. $\endgroup$
    – Glen_b
    Dec 8, 2016 at 4:14
  • $\begingroup$ I'd be happy with this question if it were edited to focus on the underlying statistical issue. $\endgroup$ Dec 8, 2016 at 12:54

1 Answer 1


The distinction between exponential and general gamma has no impact on the fitted or predicted values from the GLM. So you can calculated them as normal.

Depending on how exactly you want to define Pearson residuals, it may impact the Pearson residuals by a scale factor related to the square root of the estimated deviance. Any plots based on Pearson residuals will have the same appearance either way, so unless you're calculating some quantity based on the Pearson residual it probably won't matter. However they can be rescaled by the square root of the ratio of deviances as desired (R doesn't seem to adjust its Pearson residuals by an estimated dispersion in any case, so it should make no difference).

  • $\begingroup$ Thanks. My response has 0's in it. When I fit a Gamma GLM, I got this error "Error in eval(expr, envir, enclos) : non-positive values not allowed for the 'gamma' family". I wanted to use Exponential distribution because 0 is in the support. $\endgroup$
    – 193381
    Dec 8, 2016 at 4:55
  • $\begingroup$ Actually, you should have exactly the same problem with exponential as with the Gamma, because in both cases the support is the same -- $(0,\infty)$ (don't believe Wikipedia's page on the exponential in this regard; you can't have exact zeros with the exponential) $\endgroup$
    – Glen_b
    Dec 8, 2016 at 5:08
  • $\begingroup$ @ Glen_b: Gah, you're right; I wasn't thinking. I guess my only option for continuous response is Tweedie. $\endgroup$
    – 193381
    Dec 8, 2016 at 5:11
  • $\begingroup$ Hardly your only option. I'd think zero-inflated or hurdle models; the problem with Tweedie is that a $p$ parameter than matches the proportion of zeros well is rarely one that matches the rest of the distribution well. $\endgroup$
    – Glen_b
    Dec 8, 2016 at 5:17
  • $\begingroup$ @ Glen_b: Actually, 0 is allowed in the support of exponential distribution. I looked at a textbook. Yeah, I think I need a zero-inflated model of some sort because the histogram of the response seems spiked towards 0. Hmmm...I guess Tweedie is not good for prediction a lot of the times? $\endgroup$
    – 193381
    Dec 8, 2016 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.