Announcement

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

  • Choosing appropriate _at values for the modifying variable in an interaction with margins after xtreg, fe

    Hello,

    I have some doubts about choosing appropriate _at values for the modifying variable when using margins for plotting interactions after a Fixed Effect regression (xtreg, fe).

    Do i chose the original scale of the variable or the scale of the demeaned variable that will actually be used in a fixed effect regression? The interaction is between two continuous variables.

    My opinion is that one need to inspect the scale of the demeaned variables to chose appropriate values for the moderator variable. Is this correct?

    The difference became apparent when I calculated the same fixed effects model with xtreg, fe and reg for which I calculated the demeaned variables directly. Using reg with the demeaned variables I would naturally inspect the demeaned variable and not the original one.


    What follows is an example that illustrates the differences:

    HTML Code:
    . *** Continous*Continous Interaction in a Fixed Effects model
    . xtreg DV c.var1##c.var2, fe   
    
    Fixed-effects (within) regression               Number of obs      =       820
    Group variable: ccode                           Number of groups   =        59
    
    R-sq:  within  = 0.1696                         Obs per group: min =         4
           between = 0.4895                                        avg =      13.9
           overall = 0.4106                                        max =        23
    
                                                    F(3,758)           =     51.60
    corr(u_i, Xb)  = 0.3716                         Prob > F           =    0.0000
    
    -------------------------------------------------------------------------------
               DV |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
             var1 |  -.6884199   .3839652    -1.79   0.073    -1.442181    .0653416
             var2 |  -.2343191    .194814    -1.20   0.229    -.6167581    .1481199
                  |
    c.var1#c.var2 |   .0133886   .0039325     3.40   0.001     .0056686    .0211085
                  |
            _cons |   44.74163   19.18391     2.33   0.020     7.081734    82.40153
    --------------+----------------------------------------------------------------
          sigma_u |  14.244203
          sigma_e |  9.0203402
              rho |  .71376406   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------
    F test that all u_i=0:     F(58, 758) =    22.62             Prob > F = 0.0000
    
    .
    . ***Inspect descriptives of var2, so I can see the minimal and maximum values (range) of the scale and chosee approriate _at values for margins
    . sum var2
    
        Variable |       Obs        Mean    Std. Dev.       Min        Max
    -------------+--------------------------------------------------------
            var2 |       934    85.85625    11.44415  -10.91209   111.5349
    
    .
    . ***Plot the marginal effect of var1 conditional on var2
    . margins, dydx(var1) at(var2=(-10 (20) 110))   
    
    Average marginal effects                          Number of obs   =        820
    Model VCE    : Conventional
    
    Expression   : Linear prediction, predict()
    dy/dx w.r.t. : var1
    
    1._at        : var2            =         -10
    
    2._at        : var2            =          10
    
    3._at        : var2            =          30
    
    4._at        : var2            =          50
    
    5._at        : var2            =          70
    
    6._at        : var2            =          90
    
    7._at        : var2            =         110
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    var1         |
             _at |
              1  |  -.8223054    .418488    -1.96   0.049    -1.642527    -.002084
              2  |  -.5545343   .3504558    -1.58   0.114    -1.241415    .1323464
              3  |  -.2867632   .2878854    -1.00   0.319    -.8510082    .2774819
              4  |   -.018992   .2351777    -0.08   0.936    -.4799319    .4419478
              5  |   .2487791   .2002769     1.24   0.214    -.1437564    .6413146
              6  |   .5165502   .1930929     2.68   0.007     .1380951    .8950053
              7  |   .7843214   .2164039     3.62   0.000     .3601775    1.208465
    ------------------------------------------------------------------------------
    
    . marginsplot, recast(line) recastci(rarea) yline(0)

    Click image for larger version

Name:	OriginalVariable.png
Views:	1
Size:	347.2 KB
ID:	1359274



    HTML Code:
    . ***Create the demeaned values of var2
    . egen var2_groupmean = mean(var2), by(country)
    
    . gen var2_demeaned  = var2 - var2_groupmean
    
    .
    . ***Inspect descriptives of var2_demeaned: Now i see that the scale ranges from -86 to 30, so I chose these values for the _at in margins
    . sum var2_demeaned
    
        Variable |       Obs        Mean    Std. Dev.       Min        Max
    -------------+--------------------------------------------------------
    var2_demea~d |       934    5.55e-07    8.802017  -86.65811   30.35748
    
    .
    . ***Plotting the marginal effect now shows a very different picture
    . margins, dydx(var1) at(var2=(-90 (30) 30))
    
    Average marginal effects                          Number of obs   =        820
    Model VCE    : Conventional
    
    Expression   : Linear prediction, predict()
    dy/dx w.r.t. : var1
    
    1._at        : var2            =         -90
    
    2._at        : var2            =         -60
    
    3._at        : var2            =         -30
    
    4._at        : var2            =           0
    
    5._at        : var2            =          30
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    var1         |
             _at |
              1  |   -1.89339   .7128124    -2.66   0.008    -3.290477   -.4963033
              2  |  -1.491733   .6000342    -2.49   0.013    -2.667779   -.3156879
              3  |  -1.090077   .4897111    -2.23   0.026    -2.049893   -.1302605
              4  |  -.6884199   .3839652    -1.79   0.073    -1.440978     .064138
              5  |  -.2867632   .2878854    -1.00   0.319    -.8510082    .2774819
    ------------------------------------------------------------------------------
    
    . marginsplot, recast(line) recastci(rarea) yline(0)
    Click image for larger version

Name:	DemeanedScale.png
Views:	1
Size:	347.2 KB
ID:	1359273



  • #2
    Probably there is an easier way to describe my question:

    In an interaction in a Fixed Effects model, do I use the original scale (range of values) of the modifying variable z to interpret the marginal effect of x on y? Or should I use the demeaned scale of the variable z?

    Many thanks,
    Pablo

    Comment

    Working...
    X