Announcement

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

  • (Again) Comparing regression coefficients across groups in presence of fixed effects

    Hello everyone,

    I'm having trouble comparing the coefficients of two different regressions ran in the same sample. I tried following the solutions provided in this thread (https://www.statalist.org/forums/for...for-panel-data), but to no avail.
    From my sample, I dumbed down the model and ran:

    Code:
    reg w x1 if dummy==1
    reg w x1 if dummy==0
    reg w i.dummy#(c.x1)
    My actual model has more variables with firm and year effects but I'm still not getting consistent results in this simplified setting, and so decided to post this approach. The results are the following:

    Code:
    . reg w x1 if dummy==1
    
    
    
    ------------------------------------------------------------------------------
               w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              x1 |   .4991131   .2057008     2.43   0.015     .0957979    .9024283
           _cons |   .7043454   .0191853    36.71   0.000     .6667291    .7419617
    ------------------------------------------------------------------------------
    
    . reg w x1 if dummy==0
    
    
    ------------------------------------------------------------------------------
               w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              x1 |  -4.432367   .0856548   -51.75   0.000    -4.600259   -4.264474
           _cons |   .6694037   .0218423    30.65   0.000     .6265905    .7122169
    ------------------------------------------------------------------------------
    
    . reg w i.dummy#(c.x1)
    
    
    
    ------------------------------------------------------------------------------
               w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
      dummy#c.x1 |
              0  |  -4.417468    .076771   -57.54   0.000    -4.567945   -4.266991
              1  |   .3083264   .3989169     0.77   0.440    -.4735832    1.090236
                 |
           _cons |   .6753387   .0184921    36.52   0.000     .6390926    .7115848
    I was expecting that the coefficients of dummy#c.x1 from reg w i.dummy#(c.x1) would be consistent with the individual coefficients from running reg w x1 if dummy==0 and reg w x1 if dummy==1 (for privacy reasons, I've deleted the the information regarding the number of observations, but they are consistent between models). As you can see, they aren't... Any ideas for this to happen? The ideas would be to compare the coefficients from the two first regression.

  • #2
    the problem is that you have only the interaction and not the parts; see the following example and note the use of 2 pound signs in the last regression:
    Code:
    . sysuse auto
    (1978 automobile data)
    r; t=0.01 11:28:11
    
    . regress price weight if fore==0
    
          Source |       SS           df       MS      Number of obs   =        52
    -------------+----------------------------------   F(1, 50)        =     41.26
           Model |   221173878         1   221173878   Prob > F        =    0.0000
        Residual |   268020922        50  5360418.45   R-squared       =    0.4521
    -------------+----------------------------------   Adj R-squared   =    0.4412
           Total |   489194801        51  9592054.92   Root MSE        =    2315.3
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   2.994814   .4662321     6.42   0.000     2.058359    3.931268
           _cons |  -3861.719   1579.522    -2.44   0.018    -7034.282   -689.1562
    ------------------------------------------------------------------------------
    r; t=0.23 11:28:20
    
    . regress price weight if fore==1
    
          Source |       SS           df       MS      Number of obs   =        22
    -------------+----------------------------------   F(1, 20)        =     72.66
           Model |   113204096         1   113204096   Prob > F        =    0.0000
        Residual |  31159116.4        20  1557955.82   R-squared       =    0.7842
    -------------+----------------------------------   Adj R-squared   =    0.7734
           Total |   144363213        21   6874438.7   Root MSE        =    1248.2
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |    5.36204   .6290375     8.52   0.000     4.049891    6.674189
           _cons |  -6033.316     1480.9    -4.07   0.001    -9122.419   -2944.213
    ------------------------------------------------------------------------------
    r; t=0.03 11:28:26
    
    . regress price i.fore##c.weight
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(3, 70)        =     26.20
           Model |   335885357         3   111961786   Prob > F        =    0.0000
        Residual |   299180039        70  4274000.55   R-squared       =    0.5289
    -------------+----------------------------------   Adj R-squared   =    0.5087
           Total |   635065396        73  8699525.97   Root MSE        =    2067.4
    
    ----------------------------------------------------------------------------------
               price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -----------------+----------------------------------------------------------------
             foreign |
            Foreign  |  -2171.597   2829.409    -0.77   0.445    -7814.676    3471.482
              weight |   2.994814   .4163132     7.19   0.000     2.164503    3.825124
                     |
    foreign#c.weight |
            Foreign  |   2.367227   1.121973     2.11   0.038      .129522    4.604931
                     |
               _cons |  -3861.719   1410.404    -2.74   0.008    -6674.681   -1048.757
    ----------------------------------------------------------------------------------
    r; t=0.05 11:28:39

    Comment


    • #3
      Originally posted by Rich Goldstein View Post
      the problem is that you have only the interaction and not the parts; see the following example and note the use of 2 pound signs in the last regression:
      Code:
      . sysuse auto
      (1978 automobile data)
      r; t=0.01 11:28:11
      
      . regress price weight if fore==0
      
      Source | SS df MS Number of obs = 52
      -------------+---------------------------------- F(1, 50) = 41.26
      Model | 221173878 1 221173878 Prob > F = 0.0000
      Residual | 268020922 50 5360418.45 R-squared = 0.4521
      -------------+---------------------------------- Adj R-squared = 0.4412
      Total | 489194801 51 9592054.92 Root MSE = 2315.3
      
      ------------------------------------------------------------------------------
      price | Coefficient Std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      weight | 2.994814 .4662321 6.42 0.000 2.058359 3.931268
      _cons | -3861.719 1579.522 -2.44 0.018 -7034.282 -689.1562
      ------------------------------------------------------------------------------
      r; t=0.23 11:28:20
      
      . regress price weight if fore==1
      
      Source | SS df MS Number of obs = 22
      -------------+---------------------------------- F(1, 20) = 72.66
      Model | 113204096 1 113204096 Prob > F = 0.0000
      Residual | 31159116.4 20 1557955.82 R-squared = 0.7842
      -------------+---------------------------------- Adj R-squared = 0.7734
      Total | 144363213 21 6874438.7 Root MSE = 1248.2
      
      ------------------------------------------------------------------------------
      price | Coefficient Std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      weight | 5.36204 .6290375 8.52 0.000 4.049891 6.674189
      _cons | -6033.316 1480.9 -4.07 0.001 -9122.419 -2944.213
      ------------------------------------------------------------------------------
      r; t=0.03 11:28:26
      
      . regress price i.fore##c.weight
      
      Source | SS df MS Number of obs = 74
      -------------+---------------------------------- F(3, 70) = 26.20
      Model | 335885357 3 111961786 Prob > F = 0.0000
      Residual | 299180039 70 4274000.55 R-squared = 0.5289
      -------------+---------------------------------- Adj R-squared = 0.5087
      Total | 635065396 73 8699525.97 Root MSE = 2067.4
      
      ----------------------------------------------------------------------------------
      price | Coefficient Std. err. t P>|t| [95% conf. interval]
      -----------------+----------------------------------------------------------------
      foreign |
      Foreign | -2171.597 2829.409 -0.77 0.445 -7814.676 3471.482
      weight | 2.994814 .4163132 7.19 0.000 2.164503 3.825124
      |
      foreign#c.weight |
      Foreign | 2.367227 1.121973 2.11 0.038 .129522 4.604931
      |
      _cons | -3861.719 1410.404 -2.74 0.008 -6674.681 -1048.757
      ----------------------------------------------------------------------------------
      r; t=0.05 11:28:39
      Thank you Rich! I think I now what's going on now. In the link I sent the interaction of the dummy is done via the variable x1 but also via the firm dummies. In my case, I didn't put the firm dummies hence, the interaction is missing. I was also using the - areg - command which seems to have issues in this cases as it does not do the interaction on the absorbed variables...

      Comment

      Working...
      X