GLMs are generally fitted using the algorithm known as "Iteratively (Re)weighted Least Squares." A quick Google search will return plenty of results. For a gamma-log model, let \(\mathbf{X}\) be the design matrix. Start off with an initial estimate of your vector of model parameters, \(\beta\). Then let \(\mathbf{z}\) be a vector such that\[z_i=\log(\mu_i)+\frac{y_i-\mu_i}{\mu_i}\]Note that \(\mathbf{z}\) is a function of \(\beta\). Then the next estimate iteration of \(\beta\) is given by:\[(\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{z}\]Now calculate a new vector \(\mathbf{z}\) and use the above formula to get another interation of \(\beta\). Continue iterating until the values of \(\beta\) converge.
Last edited by a moderator: Dec 10, 2013