# GLM conditional distribution from R GLM

I want to obtain the full distribution of a Gamma (or Inverse Gaussian) distributed $y_i$ given a vector of $\bar x_i$ that have been used in the linear predictor of a coefficient. Suppose also for the Gamma GLM I have used the log-link instead of the canonical link.

Since both distributions are bi-parametric I know I can get the estimation of the mean parameter by predict(glmObj, ..., type="response") whichever distribution whichever link I have used. I'm not sure about the conditional variance. I know that $var\left(y_i\right)=\phi*V\left(\mu_i\right)$. My questions are:

1. Is it correct to estimate $\phi$, the dispersion parameter, as the square root of glmObj$deviance/glmObj$df.residual, regardless of the distribution and canonical link?

2. Is $V\left(\mu_i\right)$ dependent on the canonical link?

• You can get "standard errors" (not prediction errors) from predict using the argument se.fit=TRUE. It doesn't give you their covariance, however. Any two predicted values are a function of a linear combination of regression parameters. These usually aren't independent. It is easy to compute by hand, however. – AdamO Jun 18 '13 at 15:53
• The estimate of $\phi$ from GLMs is generally not ML (it is in some cases, but usually not); indeed in some cases the ML estimate doesn't even make sense (Poisson regression for example). The package MASS includes functions for ML estimation of the parameter corresponding to $\phi$ in one or two cases (such as the Gamma). As for 'correct' -- it depends on what you mean by 'correct'. – Glen_b Jul 18 '13 at 16:47
• If you want to estimate the dispersion parameter $\phi$, where $\phi\ne 1$ then u need to use the quasi-likelihood approach. For example for the poisson glm, u need something like: glm(y ~ x, family =quasipoisson(link = "log")). When the $\phi=1$, then the quasi-likelihood will be the ML estimate. – Stat Dec 16 '13 at 2:01