2
$\begingroup$

I am trying to model an outcome using a generalized linear model and the Gamma distribution with a log link function using the glm() function in R. I went to Wikipedia to look at the parameterizations for the Gamma distribution. Now I would like to state the model formally with $shape = k$ and $scale = \theta$ in a manuscript. What I would like to do is something along those lines:

$y_{i}\sim \Gamma(k,\theta_{i})$

$E(y_{i})=k\theta_{i}$ and $var(y_{i}) =k\theta_{i}^{2}$

$log(k\theta_{i})=\alpha +\beta_{1}X_{i}$

My question is whether this is correct? I read that the glm() function in R only models the scale parameter $\theta$ as a function of the independent variables (hence the index for $\theta$) whereas the shape parameter $k$ is constant and appears as the dispersion parameter $\phi = 1/k$ in the glm() output.

My second question would be how can I change the variance specification ($Var(y_{i}) =k\theta_{i}^{2}$) when I want $k\theta_{i} = \mu_{i}$ so that the model would look like:

$log(\mu_{i})=\alpha +\beta_{1}X_{i}$

This doesn't seem correct: $var(y_{i}) = \mu_{i}\theta_{i}$, or does it?

$\endgroup$
5
  • 1
    $\begingroup$ You will probably want to use the shape-mean parameterization. Quite a few posts on site discuss this parameterization. See stats.stackexchange.com/questions/136909/… for an explicit density, One reference that explicitly discusses it is the book by de Jong and Heller. $\endgroup$
    – Glen_b
    Aug 25, 2020 at 5:09
  • 1
    $\begingroup$ Thank you @Glen_b for the comment and the links. I think I did found my answer now in Faraway 2006, page 149, where he suggest that in a GLM setting it is more convenient to reparameterize the distribution with $\lambda = \nu/\mu$, which then results in $E(Y)=\mu$ and $var(Y)=\mu^2/\nu$ $\endgroup$
    – Stefan
    Aug 25, 2020 at 14:20
  • $\begingroup$ Sure, that would be starting with $\nu$ as shape and $\lambda$ as a rate parameter (in your question's notation, these would be $k$ and $1/\theta$). You could post an answer along the lines of your comment if you wish, $\endgroup$
    – Glen_b
    Aug 25, 2020 at 23:42
  • $\begingroup$ See stats.stackexchange.com/questions/474326/deviance-for-gamma-glm It is specifically for the gamma deviance but, on the way, it clarifies the parametrization for gamma glms. $\endgroup$ Aug 26, 2020 at 2:09
  • $\begingroup$ @GordonSmyth Thanks for the link! $\endgroup$
    – Stefan
    Aug 26, 2020 at 5:06

1 Answer 1

1
$\begingroup$

Using the shape ($\nu$) and rate ($\lambda$) parameterizations for the density of the Gamma distribution we get:

$$f(y)=\frac{1}{\Gamma(\nu)}\lambda^\nu y^{\nu-1}e^{-\lambda y}\qquad y>0$$

Now we can reparameterize by setting $\lambda=\nu/\mu$ and get:

$$f(y)=\frac{1}{\Gamma(\nu)}\left(\frac{\nu}{\mu}\right)^\nu y^{\nu-1}e^{-\left(\frac{y\nu}{\mu}\right)}\qquad y>0$$

Now: $$EY=\mu \quad \mathbb{and} \quad var\,Y=\frac{\mu^2}{\nu}$$

To translate this into your notation:

$$y_{i}\sim \Gamma(\mu_{i},\nu)$$ $$E(y_{i})=\mu_{i}\quad \mathbb{and} \quad var(y_{i})=\frac{\mu_{i}^2}{\nu}$$ $$log(\mu_{i})=\alpha +\beta_{1}X_{i}$$


Reference: Faraway (2006): Extending the linear model with R (page 149).

$\endgroup$

Your Answer

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

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