Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • log of the DV changes the coefficient of the IV (from positive to negative) in a two-way effects panel analysis

    Hello everyone,

    I am conducting a panel analysis to measure the correlation between income (dependent variable) and foreign investment (independent variable). The correlation coefficient changed from positive to negative when I take the log of income and add a time dummy to the model (two-way effects). To my knowledge, log transformation should not change the sign of the coefficient, can anyone please explain?

    Thank you in advance for your comments and hint.

  • #2
    Please follow the FAQ and show us what you typed in Stata and what it returned. If you took the log and adding a time dummy (or dummies) at the same time then it's impossible to know what is causing the changing sign.

    It's actually possible for that to happen. I've seen it with count outcomes in going from a linear model to an exponential model, which is not unlike taking the log of a positive outcome such as income. You need to do this in steps You should include time dummies with everything unless T is very large. Then, you can explore the functional form issue.

    Comment


    • #3
      Command.pdf
      Originally posted by Jeff Wooldridge View Post
      Please follow the FAQ and show us what you typed in Stata and what it returned. If you took the log and adding a time dummy (or dummies) at the same time then it's impossible to know what is causing the changing sign.

      It's actually possible for that to happen. I've seen it with count outcomes in going from a linear model to an exponential model, which is not unlike taking the log of a positive outcome such as income. You need to do this in steps You should include time dummies with everything unless T is very large. Then, you can explore the functional form issue.
      Dear Prof. Wooldridge,

      Thank you very much for your prompt response. I have attached my Stata commands and outputs below. I log the variable first and then include it in my regression. Thanks again.


      Sincerely yours,

      Rui

      Command.pdf
      Attached Files
      Last edited by sladmin; 23 Aug 2021, 15:52. Reason: Capitalization

      Comment


      • #4
        As unnatural as it might be -- because log() is a monotonically increasing transformation so we might expect that the sign of the regression parameter would be preserved under this monotonically increasing transformation on the dependent variable -- it happens.

        See the simulation in this stackexchange post
        https://stats.stackexchange.com/ques...n-coefficients

        Comment


        • #5
          Originally posted by Joro Kolev View Post
          As unnatural as it might be -- because log() is a monotonically increasing transformation so we might expect that the sign of the regression parameter would be preserved under this monotonically increasing transformation on the dependent variable -- it happens.

          See the simulation in this stackexchange post
          https://stats.stackexchange.com/ques...n-coefficients
          Dear Prof. Kolev, Thank you very much. I will indeed check out this stackexchange post. Sincerely yours, Rui

          Comment


          • #6
            Here it is in Stata, and I had to run the do file 4 or 5 times until I got an example where the coefficients had different signs.

            Code:
            . set obs 20 
            number of observations (_N) was 0, now 20
            
            . 
            . gen x = exp(rnormal())
            
            . 
            . gen y = exp(.1*x + rnormal())
            
            . 
            . gen double logy = log(y)
            
            . 
            . reg y x
            
                  Source |       SS           df       MS      Number of obs   =        20
            -------------+----------------------------------   F(1, 18)        =      0.01
                   Model |  .045021905         1  .045021905   Prob > F        =    0.9124
                Residual |  65.0854665        18  3.61585925   R-squared       =    0.0007
            -------------+----------------------------------   Adj R-squared   =   -0.0548
                   Total |  65.1304884        19  3.42792044   Root MSE        =    1.9015
            
            ------------------------------------------------------------------------------
                       y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                       x |  -.0393736   .3528567    -0.11   0.912     -.780698    .7019509
                   _cons |   2.262158   .5749559     3.93   0.001      1.05422    3.470095
            ------------------------------------------------------------------------------
            
            . 
            . reg logy x
            
                  Source |       SS           df       MS      Number of obs   =        20
            -------------+----------------------------------   F(1, 18)        =      0.22
                   Model |  .293482665         1  .293482665   Prob > F        =    0.6467
                Residual |  24.3079114        18  1.35043952   R-squared       =    0.0119
            -------------+----------------------------------   Adj R-squared   =   -0.0430
                   Total |   24.601394        19  1.29481021   Root MSE        =    1.1621
            
            ------------------------------------------------------------------------------
                    logy |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                       x |   .1005273   .2156404     0.47   0.647    -.3525165     .553571
                   _cons |   .2176695   .3513713     0.62   0.543    -.5205343    .9558733
            ------------------------------------------------------------------------------
            
            .
            Originally posted by Rui Yang View Post

            Dear Prof. Kolev, Thank you very much. I will indeed check out this stackexchange post. Sincerely yours, Rui

            Comment

            Working...
            X