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?