Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: Comparison of the R-squared in a loglog and linear model

 From "Jay Tuthill" To Subject RE: st: Comparison of the R-squared in a loglog and linear model Date Mon, 21 Jun 2010 11:55:50 -0400

```It has been awhile since I looked at this but recall a technique from grad school using the geometric mean. For your dependent variable y, create a log variable

gen lny = log(y)

get the average of this
su lny

create a transform for y
gen ty = y/exp(r(mean))

where r(mean) is the mean of the log y's and exp converts it to the geometric mean

create the log of the ty
gen ln_ty = log(ty)

now regress ty and ln_ty separately and compare the standard errors of the regressions; they are directly comparable on the transformed dependent variable

For references on this see S. Wiesberg Applied Linear Regression, 2nd ed, 1985, sec 6.4 especially p. 148 and for a more advanced explanation...Cook and Weisberg, Residuals and Influence in Regression, 1982, sec 2.4

Regards...Jay Tuthill

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Natalie Trapp
Sent: Thursday, June 17, 2010 7:28 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Comparison of the R-squared in a loglog and linear model

Thank you very much!

On 6/17/2010 12:10 PM, Richard Goldstein wrote:
> there have been attempts in Stata; in my opinion the best of these is
> -brsq- from an old STB (type -findit brsq-); of course, as one of the
> authors, I'm undoubtedly somewhat biased; look carefully at the STB
> article to ensure it does what you want and to see some references to
> other attempts
>
> Rich
>
> On 6/17/10 6:01 AM, Natalie Trapp wrote:
>
>> Thank you Maarten.
>>
>> That's right, an R-square comparison is meaningful only if the dependent
>> variable is the same for both models.
>>
>> Can I not maybe obtain the antilog predicted values for the log log
>> model and compute the R-squared between the antilog of the observed and
>> predicted values. And then compare this R-square with the R-square
>> obtained from OLS estimation of the linear model?
>>
>> There are other statistical programs that can do this automatically, but
>> as I work with Stata, I'd rather do it with this program.
>>
>> On 6/17/2010 11:49 AM, Maarten buis wrote:
>>
>>> --- On Thu, 17/6/10, Natalie Trapp wrote:
>>>
>>>
>>>> I would like to compare the R-squared of a log log model
>>>> and a linear model to find out which has the better fit. Is
>>>> there a tool in Stata with which I can compare the R-square
>>>> of the log log model with the R-square obtained from OLS
>>>> estimation of the linear model?
>>>>
>>>>
>>> Comparing R-squares only makes sense when you don't change
>>> the dependent variable: the proportion of variance explained
>>> depends both the how much you explain and on how much variance
>>> you had to begin with. A non-linear transformation like taking
>>> the logarithm will influence the variance of your dependent
>>> variable, making the R-squares of the linear model and the
>>> log-log model incomparable.
>>>
>>> Hope this helps,
>>> Maarten
>>>
>>> --------------------------
>>> Maarten L. Buis
>>> Institut fuer Soziologie
>>> Universitaet Tuebingen
>>> Wilhelmstrasse 36
>>> 72074 Tuebingen
>>> Germany
>>>
>>> http://www.maartenbuis.nl
>>> --------------------------
>>>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```