# GLM with log link vs linear regression with logarithmic transformation parameter estimation

I am trying to calculate the parameter estimates of GLM with log link and normal distribution and the linear regression with logarithmic transformation. For the first I get the total derivative of the loglikelihood with respect to $$\beta$$ as: $$\frac{-1}{\sigma^2}((e^{x_1^T\beta}-y_1)e^{x_1^T\beta},...,(e^{x_n^T\beta}-y_n)e^{x_n^T\beta})X$$ Then I do the same for loglinear regression.

$$\frac{-1}{\sigma^2}(x_1^T\beta-\log(y_1),...,x_n^T\beta-\log(y_n))X.$$

So basically when I set it to $$0$$ and solve it I get the same result.

• There is math markup, $\LaTeX$, on this site. Please edit your post, see stats.meta.stackexchange.com/questions/1604/… Commented Aug 17, 2023 at 22:43
• This stats.stackexchange.com/questions/47840/… looks like a duplicate! Commented Aug 17, 2023 at 22:44
• @kjetilbhalvorsen but that focuses more on the interpretation rather than the mathematical details and it doesn't really touch on the parameter estimation Commented Aug 17, 2023 at 22:47
• Did you try estimating both models on some actual data? It would immediately resolve the question of whether they were the same (you would discover that they aren't) and that would suggest you should revise your thinking. Many other posts on site are relevant. E.g. stats.stackexchange.com/questions/77579/… quickly resolves the question of whether they are equal (in the negative) and to at least some extent discusses why not. Commented Aug 17, 2023 at 23:52

To get the calculation right, let's start with one parameter, $$\beta_0$$. It's important to get the summations in the right places, and I think that might have been your problem.

The GLM with log link and normal distribution has estimating equation $$\sum_{i=1}^n (\exp\beta_0)(Y_i-\exp \beta_0)=0$$ The log-transformed Normal has estimating equation $$\sum_{i=1}^n (\log Y_i-\beta_0)=0.$$

These aren't the same.

In the first one, the weight $$\exp\beta_0$$ is constant and we can divide through by it. The remaining equation is $$\sum_{i=1}^n (Y_i-\exp \beta_0)=0$$ which is solved by $$\exp\beta = \bar Y$$.

The second one is solved by $$\beta=\overline{\log Y}$$, so $$\exp\beta$$ is the geometric mean of $$Y$$: $$\exp\beta = \exp \left( \frac{1}{n}\sum_i \log Y_i\right).$$

These are importantly different. For a start, the second equation breaks down if any $$Y$$ is zero or negative, but the first one breaks down only if the mean of $$Y$$ is zero or negative. The first one models $$Y$$ as having a Normal distribution; the second models $$\log Y$$ as having a Normal distribution

Once you introduce non-trivial $$X$$, the weight term doesn't factor out of the first equation and it gives a weighted mean rather than a simple mean, but there's still the same difference between taking a mean of $$Y$$ and taking a mean of $$\log Y$$.

(One would more often compare linear regression on the logarithm and a GLM with log link and Gamma error. These are much more similar; in particular, they have the same range constraints on $$Y$$. They still aren't the same.)