Quantcast

Comparison of the R-squared in a loglog and linear model

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Comparison of the R-squared in a loglog and linear model

Natalie Trapp
Dear all,

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?

Natalie

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Maarten buis
--- 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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Natalie Trapp
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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Richard Goldstein
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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Natalie Trapp
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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Christopher Baum-2
In reply to this post by Natalie Trapp
<>
On Jun 18, 2010, at 2:33 AM, Natalie wrote:

> 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.


findit levpredict

Generate the level form of the dependent variable (correctly, using this routine) and then
compute the squared correlation between that and the original level variable. That will be the
R^2 of the log form of the regression.

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Austin Nichols
Kit et al.--
Duan's smearing method is one approach to dealing with a logged
depvar; a better approach is to use a regression technique that
respects the functional form, like -poisson- (or another member of the
-glm- family). But you still cannot compare the R-squared across
non-nested models and hope to conclude anything about which model is
better from that information alone.  Mean squared prediction error in
levels for the nonzero outcomes seems a reasonable criterion for
rejecting the log(y) regression model below.

use http://fmwww.bc.edu/ec-p/data/mus/mus03data, clear
qui reg totexp suppins phylim actlim totchr age female income
predict xb
qui reg ltotexp suppins phylim actlim totchr age female income
levpredict tenorm
levpredict teduan, duan print
qui poisson totexp suppins phylim actlim totchr age female income
predict tepois
qui nbreg totexp suppins phylim actlim totchr age female income
predict tenbreg
su totexp xb te*
su totexp xb te* if totexp>0
corr totexp xb te*
g mse_xb=(totexp-xb)^2/1e6
g mse_norm=(totexp-tenorm)^2/1e6
g mse_duan=(totexp-teduan)^2/1e6
g mse_pois=(totexp-tepois)^2/1e6
g mse_nbreg=(totexp-tenbreg)^2/1e6
su mse*
su mse* if totexp>0

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      mse_xb |      2955    127.0504    642.6503     .00005   12779.11
    mse_norm |      2955    142.4353    641.0374   3.32e-06   11744.09
    mse_duan |      2955    140.7604    644.1605   .0000549   11842.16
    mse_pois |      2955    128.3255    648.1356   4.52e-06   12841.78
   mse_nbreg |      2955    131.8694    642.3027   2.48e-06   12432.65

For those enamored of scatter plots for this kind of comparison, much
more work is required to get a good picture of fit.  This is one
approach:

g cr_te=totexp^(1/3)
g cr_xb=sign(xb)*abs(xb)^(1/3)
g cr_norm=tenorm^(1/3)
g cr_duan=teduan^(1/3)
g cr_pois=tepois^(1/3)
g cr_nbreg=tenbreg^(1/3)
sc cr_* cr_te if totexp>0, msize(1 1 1 1 1 1)

On Fri, Jun 18, 2010 at 9:47 AM, Christopher Baum <[hidden email]> wrote:

> <>
> On Jun 18, 2010, at 2:33 AM, Natalie wrote:
>
>> 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.
>
>
> findit levpredict
>
> Generate the level form of the dependent variable (correctly, using this routine) and then
> compute the squared correlation between that and the original level variable. That will be the
> R^2 of the log form of the regression.
*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Joao Ricardo F. Lima
Austin,

the question is not my opinion to the thread. I only don't understand
this part of the code:

g mse_xb=(totexp-xb)^2/1e6

What's -1e6-??

Thx a lot,

Joao Lima

2010/6/18 Austin Nichols <[hidden email]>:

> Kit et al.--
> Duan's smearing method is one approach to dealing with a logged
> depvar; a better approach is to use a regression technique that
> respects the functional form, like -poisson- (or another member of the
> -glm- family). But you still cannot compare the R-squared across
> non-nested models and hope to conclude anything about which model is
> better from that information alone.  Mean squared prediction error in
> levels for the nonzero outcomes seems a reasonable criterion for
> rejecting the log(y) regression model below.
>
> use http://fmwww.bc.edu/ec-p/data/mus/mus03data, clear
> qui reg totexp suppins phylim actlim totchr age female income
> predict xb
> qui reg ltotexp suppins phylim actlim totchr age female income
> levpredict tenorm
> levpredict teduan, duan print
> qui poisson totexp suppins phylim actlim totchr age female income
> predict tepois
> qui nbreg totexp suppins phylim actlim totchr age female income
> predict tenbreg
> su totexp xb te*
> su totexp xb te* if totexp>0
> corr totexp xb te*
>
> g mse_norm=(totexp-tenorm)^2/1e6
> g mse_duan=(totexp-teduan)^2/1e6
> g mse_pois=(totexp-tepois)^2/1e6
> g mse_nbreg=(totexp-tenbreg)^2/1e6
> su mse*
> su mse* if totexp>0
>
>    Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>      mse_xb |      2955    127.0504    642.6503     .00005   12779.11
>    mse_norm |      2955    142.4353    641.0374   3.32e-06   11744.09
>    mse_duan |      2955    140.7604    644.1605   .0000549   11842.16
>    mse_pois |      2955    128.3255    648.1356   4.52e-06   12841.78
>   mse_nbreg |      2955    131.8694    642.3027   2.48e-06   12432.65
>
> For those enamored of scatter plots for this kind of comparison, much
> more work is required to get a good picture of fit.  This is one
> approach:
>
> g cr_te=totexp^(1/3)
> g cr_xb=sign(xb)*abs(xb)^(1/3)
> g cr_norm=tenorm^(1/3)
> g cr_duan=teduan^(1/3)
> g cr_pois=tepois^(1/3)
> g cr_nbreg=tenbreg^(1/3)
> sc cr_* cr_te if totexp>0, msize(1 1 1 1 1 1)
>
> On Fri, Jun 18, 2010 at 9:47 AM, Christopher Baum <[hidden email]> wrote:
>> <>
>> On Jun 18, 2010, at 2:33 AM, Natalie wrote:
>>
>>> 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.
>>
>>
>> findit levpredict
>>
>> Generate the level form of the dependent variable (correctly, using this routine) and then
>> compute the squared correlation between that and the original level variable. That will be the
>> R^2 of the log form of the regression.
> *
> *   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/
>



--
----------------------------------------
Joao Ricardo Lima, D.Sc.
Professor
UFPB-CCA-DCFS
Fone: +558387264913
Skype: joao_ricardo_lima
----------------------------------------

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Martin Weiss-5

<>

Shorthand for a "million", I would say:

*************
di 1e6
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Joao Ricardo F.
Lima
Gesendet: Samstag, 19. Juni 2010 19:11
An: [hidden email]
Betreff: Re: st: Comparison of the R-squared in a loglog and linear model

Austin,

the question is not my opinion to the thread. I only don't understand
this part of the code:

g mse_xb=(totexp-xb)^2/1e6

What's -1e6-??

Thx a lot,

Joao Lima

2010/6/18 Austin Nichols <[hidden email]>:

> Kit et al.--
> Duan's smearing method is one approach to dealing with a logged
> depvar; a better approach is to use a regression technique that
> respects the functional form, like -poisson- (or another member of the
> -glm- family). But you still cannot compare the R-squared across
> non-nested models and hope to conclude anything about which model is
> better from that information alone.  Mean squared prediction error in
> levels for the nonzero outcomes seems a reasonable criterion for
> rejecting the log(y) regression model below.
>
> use http://fmwww.bc.edu/ec-p/data/mus/mus03data, clear
> qui reg totexp suppins phylim actlim totchr age female income
> predict xb
> qui reg ltotexp suppins phylim actlim totchr age female income
> levpredict tenorm
> levpredict teduan, duan print
> qui poisson totexp suppins phylim actlim totchr age female income
> predict tepois
> qui nbreg totexp suppins phylim actlim totchr age female income
> predict tenbreg
> su totexp xb te*
> su totexp xb te* if totexp>0
> corr totexp xb te*
>
> g mse_norm=(totexp-tenorm)^2/1e6
> g mse_duan=(totexp-teduan)^2/1e6
> g mse_pois=(totexp-tepois)^2/1e6
> g mse_nbreg=(totexp-tenbreg)^2/1e6
> su mse*
> su mse* if totexp>0
>
>    Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>      mse_xb |      2955    127.0504    642.6503     .00005   12779.11
>    mse_norm |      2955    142.4353    641.0374   3.32e-06   11744.09
>    mse_duan |      2955    140.7604    644.1605   .0000549   11842.16
>    mse_pois |      2955    128.3255    648.1356   4.52e-06   12841.78
>   mse_nbreg |      2955    131.8694    642.3027   2.48e-06   12432.65
>
> For those enamored of scatter plots for this kind of comparison, much
> more work is required to get a good picture of fit.  This is one
> approach:
>
> g cr_te=totexp^(1/3)
> g cr_xb=sign(xb)*abs(xb)^(1/3)
> g cr_norm=tenorm^(1/3)
> g cr_duan=teduan^(1/3)
> g cr_pois=tepois^(1/3)
> g cr_nbreg=tenbreg^(1/3)
> sc cr_* cr_te if totexp>0, msize(1 1 1 1 1 1)
>
> On Fri, Jun 18, 2010 at 9:47 AM, Christopher Baum <[hidden email]> wrote:
>> <>
>> On Jun 18, 2010, at 2:33 AM, Natalie wrote:
>>
>>> 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.
>>
>>
>> findit levpredict
>>
>> Generate the level form of the dependent variable (correctly, using this
routine) and then
>> compute the squared correlation between that and the original level
variable. That will be the
>> R^2 of the log form of the regression.
> *
> *   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/
>



--
----------------------------------------
Joao Ricardo Lima, D.Sc.
Professor
UFPB-CCA-DCFS
Fone: +558387264913
Skype: joao_ricardo_lima
----------------------------------------

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Comparison of the R-squared in a loglog and linear model

Joao Ricardo F. Lima
In reply to this post by Joao Ricardo F. Lima
Martin,

exactly! Thx!

JL

2010/6/19 Martin Weiss <[hidden email]>:

>
> <>
>
> Shorthand for a "million", I would say:
>
> *************
> di 1e6
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [hidden email]
> [mailto:[hidden email]] Im Auftrag von Joao Ricardo F.
> Lima
> Gesendet: Samstag, 19. Juni 2010 19:11
> An: [hidden email]
> Betreff: Re: st: Comparison of the R-squared in a loglog and linear model
>
> Austin,
>
> the question is not my opinion to the thread. I only don't understand
> this part of the code:
>
> g mse_xb=(totexp-xb)^2/1e6
>
> What's -1e6-??
>
> Thx a lot,
>
> Joao Lima
>
> 2010/6/18 Austin Nichols <[hidden email]>:
>> Kit et al.--
>> Duan's smearing method is one approach to dealing with a logged
>> depvar; a better approach is to use a regression technique that
>> respects the functional form, like -poisson- (or another member of the
>> -glm- family). But you still cannot compare the R-squared across
>> non-nested models and hope to conclude anything about which model is
>> better from that information alone.  Mean squared prediction error in
>> levels for the nonzero outcomes seems a reasonable criterion for
>> rejecting the log(y) regression model below.
>>
>> use http://fmwww.bc.edu/ec-p/data/mus/mus03data, clear
>> qui reg totexp suppins phylim actlim totchr age female income
>> predict xb
>> qui reg ltotexp suppins phylim actlim totchr age female income
>> levpredict tenorm
>> levpredict teduan, duan print
>> qui poisson totexp suppins phylim actlim totchr age female income
>> predict tepois
>> qui nbreg totexp suppins phylim actlim totchr age female income
>> predict tenbreg
>> su totexp xb te*
>> su totexp xb te* if totexp>0
>> corr totexp xb te*
>>
>> g mse_norm=(totexp-tenorm)^2/1e6
>> g mse_duan=(totexp-teduan)^2/1e6
>> g mse_pois=(totexp-tepois)^2/1e6
>> g mse_nbreg=(totexp-tenbreg)^2/1e6
>> su mse*
>> su mse* if totexp>0
>>
>>    Variable |       Obs        Mean    Std. Dev.       Min        Max
>> -------------+--------------------------------------------------------
>>      mse_xb |      2955    127.0504    642.6503     .00005   12779.11
>>    mse_norm |      2955    142.4353    641.0374   3.32e-06   11744.09
>>    mse_duan |      2955    140.7604    644.1605   .0000549   11842.16
>>    mse_pois |      2955    128.3255    648.1356   4.52e-06   12841.78
>>   mse_nbreg |      2955    131.8694    642.3027   2.48e-06   12432.65
>>
>> For those enamored of scatter plots for this kind of comparison, much
>> more work is required to get a good picture of fit.  This is one
>> approach:
>>
>> g cr_te=totexp^(1/3)
>> g cr_xb=sign(xb)*abs(xb)^(1/3)
>> g cr_norm=tenorm^(1/3)
>> g cr_duan=teduan^(1/3)
>> g cr_pois=tepois^(1/3)
>> g cr_nbreg=tenbreg^(1/3)
>> sc cr_* cr_te if totexp>0, msize(1 1 1 1 1 1)
>>
>> On Fri, Jun 18, 2010 at 9:47 AM, Christopher Baum <[hidden email]> wrote:
>>> <>
>>> On Jun 18, 2010, at 2:33 AM, Natalie wrote:
>>>
>>>> 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.
>>>
>>>
>>> findit levpredict
>>>
>>> Generate the level form of the dependent variable (correctly, using this
> routine) and then
>>> compute the squared correlation between that and the original level
> variable. That will be the
>>> R^2 of the log form of the regression.
>> *
>> *   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/
>>
>
>
>
> --
> ----------------------------------------
> Joao Ricardo Lima, D.Sc.
> Professor
> UFPB-CCA-DCFS
> Fone: +558387264913
> Skype: joao_ricardo_lima
> ----------------------------------------
>
> *
> *   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/
>



--
----------------------------------------
Joao Ricardo Lima, D.Sc.
Professor
UFPB-CCA-DCFS
Fone: +558387264913
Skype: joao_ricardo_lima
----------------------------------------

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Jay Tuthill
In reply to this post by Natalie Trapp
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: [hidden email] [mailto:[hidden email]] On Behalf Of Natalie Trapp
Sent: Thursday, June 17, 2010 7:28 AM
To: [hidden email]
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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Maarten buis
--- On Mon, 21/6/10, Jay Tuthill wrote:
> 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

Another reference is:
Roger Newson (2003) "Stata tip 1: The eform() option of regress"
The Stata Journal, 3(4):445.
http://www.stata-journal.com/article.html?article=st0054

The real question is whether you really want to know how the
geometric mean changes when an explanatory variable changes, or
whether you want to know how the arithmatic (regular) mean changes
when an explanatory variable changes... If you care about the
latter then your best choice is -glm- with the -line(log)- option,
see the article by Nick et al. I refered to earlier today:
<http://www.stata.com/statalist/archive/2010-06/msg01168.html>.

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/
Loading...