I have a relationship of two variables which is somehow log shaped. Now, I establish two models for this dataset, for one I log transform the dependent variable:

    fit=lm(y~x) #lm fits the linear model

If fit_ln has a higher R², is it valid to say that the fit_ln model is the better one?


Nope, that will not work. Because the outcome is not the same, and the scaling is not linear.

There are many ways to get a measure, but the one suggested by Wooldridge is to calculate the square correlation af $y$ (in levels) and the fitted value $\hat{y}$ obtained from the regression - after a back transformation.

Now, of course, the question is how to obtained a prediction, when $log(y)$ is the dependent variable. Wooldridge suggests (but there are many ways to do this):

  1. Obtain the fitted values from $log(y)$ on $x_1, x_2, ... , x_n$, as well as the residuals $u_i$.

  2. Calculate: $a_0 = n^{-1} \sum_{i=1}^n exp(u_i)$

  3. Then for each $y_i$ calculate: $\hat{y}_i = a_0 \cdot exp(\widehat{log(y)})$

Now you can calculate an $R^2$ which is comparable.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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