Announcement

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

  • interpreting interaction terms

    Hi I need help in intepreting interaction terms after running a fixed-effect model regression.

    Here is my regression code and thereafter the output:

    Code:
    xtreg SP_3m i.ECL##c.(BVEBLLPS EBCLPS CLPS LLPS) trend, fe vce(cluster C_ID)
    Code:
    Fixed-effects (within) regression               Number of obs     =      3,847
    Group variable: C_ID                            Number of groups  =        163
    
    R-sq:                                           Obs per group:
         within  = 0.4212                                         min =          1
         between = 0.5445                                         avg =       23.6
         overall = 0.4241                                         max =         44
    
                                                    F(10,162)         =      11.99
    corr(u_i, Xb)  = 0.0817                         Prob > F          =     0.0000
    
                                       (Std. Err. adjusted for 163 clusters in C_ID)
    --------------------------------------------------------------------------------
                   |               Robust
             SP_3m |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
             1.ECL |  -.9309141   .8287776    -1.12   0.263    -2.567514    .7056861
          BVEBLLPS |   .3881563   .0830101     4.68   0.000     .2242349    .5520777
            EBCLPS |   2.771403   .9288563     2.98   0.003     .9371753     4.60563
              CLPS |  -4.081289   2.029158    -2.01   0.046    -8.088301   -.0742781
              LLPS |  -.5309146   .2554378    -2.08   0.039    -1.035332   -.0264975
                   |
    ECL#c.BVEBLLPS |
                1  |  -.0368249    .042226    -0.87   0.384    -.1202092    .0465594
                   |
      ECL#c.EBCLPS |
                1  |   1.731694   1.257783     1.38   0.170      -.75207    4.215458
                   |
        ECL#c.CLPS |
                1  |  -6.616726   2.481017    -2.67   0.008    -11.51603   -1.717423
                   |
        ECL#c.LLPS |
                1  |  -.4354413   .1637303    -2.66   0.009    -.7587622   -.1121204
                   |
             trend |   .0803695   .0436028     1.84   0.067    -.0057337    .1664726
             _cons |   5.063715   1.490964     3.40   0.001     2.119484    8.007946
    ---------------+----------------------------------------------------------------
           sigma_u |  12.088387
           sigma_e |  5.3343022
               rho |   .8370137   (fraction of variance due to u_i)
    --------------------------------------------------------------------------------
    What I dont fully grasp is how to interpret the interaction terms. First i conclude that, for example that the interaction ECL#c.BVEBLLPS is not significant but ECL#c.CLPS is. My intepretation of this is that ECL has a significant impact on CLPS but not on BVEBLLPS.

    However I've been trying to understand how to inteperet interaction and have come across a lot of article which mentions having to run -margins- to fully understand interaction effects. If i run, for example:
    Code:
    margins ECL, dydx(BVEBLLPS)
    i get the following output:
    Code:
    Average marginal effects                        Number of obs     =      3,847
    Model VCE    : Robust
    
    Expression   : Linear prediction, predict()
    dy/dx w.r.t. : BVEBLLPS
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    BVEBLLPS     |
             ECL |
              0  |   .3881563   .0830101     4.68   0.000     .2254594    .5508531
              1  |   .3513314   .0706185     4.98   0.000     .2129218     .489741
    ------------------------------------------------------------------------------
    and my conclusion of this is that BVEBLLPS is statistically significant under either ECL=1 or ECL=0 but can the coefficients be compared? I see that dydx for ECL=1 is smaller than under ECL=0, does this indicate that BVEBLLPS has a lesser impact when ECL=1 or what interpretations can one make of this? Again, ECL#BVEBLLPS was not significant to start with.

    I apologize if i have misstated anything in regards to forum manners, this is my first post.

  • #2
    Plot the marginal effects using marginsplot. That will help you even more. Simply run marginsplot after your margins command. You should get two lines for ECL, and the plot will show you the slope of those lines as BVEBLLPS increases.

    Comment


    • #3
      Hi, ive attached the output after running -marginsplot- but im not quite sure what that gives in form of intepretation. My question was rather whether we can judge whether or not ECL has a significant impact on BVEBLLPS. The interaction term was not significant but the margins output was significant.
      Click image for larger version

Name:	Graph.png
Views:	1
Size:	25.1 KB
ID:	1605168

      Comment


      • #4
        It's pretty hard for me to understand what is going on with your data and your variables. Perhaps an example would help. I'm also going to avoid using dydx to show you how you can utilize marginsplot to understand what is going on.
        Code:
        use https://www.stata-press.com/data/r16/nlswork, clear
        xtreg ln_w c.age##i.race , i(idcode) re
        
        Random-effects GLS regression                   Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1029                                         min =          1
             between = 0.1024                                         avg =        6.1
             overall = 0.0942                                         max =         15
        
                                                        Wald chi2(5)      =    3247.03
        corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |   .0181609   .0003896    46.62   0.000     .0173974    .0189244
                     |
                race |
              black  |   -.163071   .0250267    -6.52   0.000    -.2121225   -.1140195
              other  |   .1610264   .1120497     1.44   0.151    -.0585869    .3806397
                     |
          race#c.age |
              black  |   .0014711   .0007486     1.96   0.049     3.77e-06    .0029384
              other  |  -.0021524     .00337    -0.64   0.523    -.0087575    .0044526
                     |
               _cons |   1.165051   .0132216    88.12   0.000     1.139137    1.190965
        -------------+----------------------------------------------------------------
             sigma_u |  .36558352
             sigma_e |   .3034504
                 rho |  .59207578   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        Note that the interaction term for age by black is significant but not for age by other? This means that the contrast of the age slope for black is significantly different than white whereas the slope for other is not significantly different than white. We can use marginsplot to verify this.

        Code:
        margins race, at(age=(22(1)36))
        Adjusted predictions                            Number of obs     =     28,510
        Model VCE    : Conventional
        
        Expression   : Linear prediction, predict()
        
        1._at        : age             =          22
        
        2._at        : age             =          23
        
        3._at        : age             =          24
        
        4._at        : age             =          25
        
        5._at        : age             =          26
        
        6._at        : age             =          27
        
        7._at        : age             =          28
        
        8._at        : age             =          29
        
        9._at        : age             =          30
        
        10._at       : age             =          31
        
        11._at       : age             =          32
        
        12._at       : age             =          33
        
        13._at       : age             =          34
        
        14._at       : age             =          35
        
        15._at       : age             =          36
        
        ------------------------------------------------------------------------------
                     |            Delta-method
                     |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
            _at#race |
            1#white  |   1.564591    .007394   211.60   0.000     1.550099    1.579083
            1#black  |   1.433883   .0116856   122.71   0.000      1.41098    1.456786
            1#other  |   1.678263   .0585208    28.68   0.000     1.563565    1.792962
            2#white  |   1.582752   .0072596   218.02   0.000     1.568523     1.59698
            2#black  |   1.453515   .0114732   126.69   0.000     1.431028    1.476002
            2#other  |   1.694272   .0572304    29.60   0.000     1.582102    1.806441
            3#white  |   1.600913   .0071438   224.10   0.000     1.586911    1.614914
            3#black  |   1.473147   .0112932   130.45   0.000     1.451013    1.495281
            3#other  |    1.71028   .0561104    30.48   0.000     1.600306    1.820255
            4#white  |   1.619073   .0070477   229.73   0.000      1.60526    1.632887
            4#black  |   1.492779   .0111469   133.92   0.000     1.470932    1.514627
            4#other  |   1.726289    .055171    31.29   0.000     1.618156    1.834422
            5#white  |   1.637234   .0069721   234.83   0.000     1.623569    1.650899
            5#black  |   1.512411   .0110358   137.05   0.000     1.490781    1.534041
            5#other  |   1.742297   .0544216    32.01   0.000     1.635633    1.848962
            6#white  |   1.655395   .0069177   239.30   0.000     1.641837    1.668954
            6#black  |   1.532043   .0109609   139.77   0.000      1.51056    1.553526
            6#other  |   1.758306   .0538702    32.64   0.000     1.652722    1.863889
            7#white  |   1.673556   .0068849   243.08   0.000     1.660062     1.68705
            7#black  |   1.551675    .010923   142.06   0.000     1.530266    1.573084
            7#other  |   1.774314   .0535228    33.15   0.000     1.669411    1.879217
            8#white  |   1.691717    .006874   246.10   0.000     1.678244     1.70519
            8#black  |   1.571307   .0109224   143.86   0.000     1.549899    1.592714
            8#other  |   1.790323   .0533834    33.54   0.000     1.685693    1.894952
            9#white  |   1.709878   .0068852   248.34   0.000     1.696383    1.723373
            9#black  |   1.590939   .0109592   145.17   0.000     1.569459    1.612418
            9#other  |   1.806331   .0534538    33.79   0.000     1.701563    1.911098
           10#white  |   1.728039   .0069184   249.78   0.000     1.714479    1.741599
           10#black  |   1.610571   .0110329   145.98   0.000     1.588947    1.632195
           10#other  |   1.822339    .053733    33.91   0.000     1.717025    1.927654
           11#white  |     1.7462   .0069732   250.42   0.000     1.732533    1.759867
           11#black  |   1.630203   .0111429   146.30   0.000     1.608363    1.652043
           11#other  |   1.838348   .0542177    33.91   0.000     1.732083    1.944613
           12#white  |   1.764361   .0070491   250.30   0.000     1.750545    1.778177
           12#black  |   1.649835   .0112881   146.16   0.000      1.62771    1.671959
           12#other  |   1.854356   .0549027    33.78   0.000     1.746749    1.961964
           13#white  |   1.782522   .0071455   249.46   0.000     1.768517    1.796526
           13#black  |   1.669467   .0114672   145.59   0.000     1.646992    1.691942
           13#other  |   1.870365   .0557805    33.53   0.000     1.761037    1.979693
           14#white  |   1.800682   .0072615   247.98   0.000      1.78645    1.814915
           14#black  |   1.689099   .0116785   144.63   0.000     1.666209    1.711988
           14#other  |   1.886373   .0568421    33.19   0.000     1.774965    1.997782
           15#white  |   1.818843   .0073963   245.91   0.000     1.804347     1.83334
           15#black  |   1.708731   .0119204   143.34   0.000     1.685367    1.732094
           15#other  |   1.902382   .0580776    32.76   0.000     1.788552    2.016212
        ------------------------------------------------------------------------------
        Note that everything is significant here. I tend not to pay attention to that unless I am doing contrasts.

        Now the
        Code:
        marginsplot
        :

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	201.9 KB
ID:	1605176


        We can see what is happening pretty clearly here, confirming my interpretation of the regression output. You may want to do this kind of work before jumping to using dydx, although I know that is discipline-specific.
        Attached Files

        Comment


        • #5
          Hi thank you! I understand that part and the analogy to my data is that the contrast of the BVEBLLPS slope for ECL=1 is not significantly different from BVEBLLPS slope for ECL=0 (note ECL is a dummy variable) but my question is more on the topic of what -margins- actually says. In my -margins- command the ouput indicates that BVEBLLPS is significant under either 0 or 1 and that the slope is lower, but are these differences in slope significant given that the interaction term was not significant?

          Comment


          • #6
            The margins estimate is telling you whether the slope of the continuous variable is significant for the two groups. It is not a test of whether the slope is different between the two groups. That comes from the slope and t-test for the interaction term in the regression model. In your case, the BVEBLLPS slope is significant whether ECL==0 or ECL==1. But the BVEBLLPS slopes for ECL==0 and ECL==1 are not significantly different from each other.

            Edit: You can also infer this from the marginsplot. The confidence intervals for the two point estimates overlap almost completely.
            Last edited by Erik Ruzek; 22 Apr 2021, 11:57.

            Comment


            • #7
              Thank you very much! That makes it a lot clearer. I have a follow-up question in that in my study i add a second interaction-variable (SMALL=1 or 0) which interacts with variables CLPS and LLPS. The reason for doing this is that i in my first regression i came to the conclusion that there is a significant difference in both CLPS and LLPS depending on whether ECL = 1 or ECL = 0 (correct?). Thereafter i wanted to investigate for ECL=1 whether size has a moderating or intensifying effect on CLPS or LLPS. I thus ran the following regression:
              Code:
              xtreg SP_3m i.ECL##c.(BVEBLLPS EBCLPS CLPS LLPS) i.ECL##i.SMALL##c.(CLPS LLPS)trend, fe vce(cluster C_ID)
              with following output:
              Code:
              Fixed-effects (within) regression               Number of obs     =      3,847
              Group variable: C_ID                            Number of groups  =        163
              
              R-sq:                                           Obs per group:
                   within  = 0.4514                                         min =          1
                   between = 0.5297                                         avg =       23.6
                   overall = 0.4095                                         max =         44
              
                                                              F(16,162)         =      15.56
              corr(u_i, Xb)  = 0.0742                         Prob > F          =     0.0000
              
                                                   (Std. Err. adjusted for 163 clusters in C_ID)
              ----------------------------------------------------------------------------------
                               |               Robust
                         SP_3m |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              -----------------+----------------------------------------------------------------
                         1.ECL |  -.5992944   .8040185    -0.75   0.457    -2.187003    .9884137
                      BVEBLLPS |   .4061056   .0772747     5.26   0.000       .25351    .5587012
                        EBCLPS |   2.422692   .8280955     2.93   0.004     .7874385    4.057945
                          CLPS |  -5.896656    3.57836    -1.65   0.101     -12.9629    1.169588
                          LLPS |  -.3596114   .3152482    -1.14   0.256    -.9821369    .2629142
                               |
                ECL#c.BVEBLLPS |
                            1  |  -.0802247   .0413599    -1.94   0.054    -.1618988    .0014495
                               |
                  ECL#c.EBCLPS |
                            1  |   2.158343   1.362504     1.58   0.115    -.5322145    4.848901
                               |
                    ECL#c.CLPS |
                            1  |  -5.416545   3.425541    -1.58   0.116    -12.18102    1.347926
                               |
                    ECL#c.LLPS |
                            1  |  -.6281097   .1815398    -3.46   0.001    -.9865991   -.2696202
                               |
                       1.SMALL |   2.002369   1.460282     1.37   0.172    -.8812723     4.88601
                               |
                     ECL#SMALL |
                          1 1  |  -.3157033     .77644    -0.41   0.685    -1.848952    1.217545
                               |
                          CLPS |          0  (omitted)
                          LLPS |          0  (omitted)
                               |
                  SMALL#c.CLPS |
                            1  |   2.443883   4.276606     0.57   0.568    -6.001199    10.88896
                               |
                  SMALL#c.LLPS |
                            1  |  -.7628885   .2664182    -2.86   0.005    -1.288989   -.2367883
                               |
              ECL#SMALL#c.CLPS |
                          1 1  |   1.013903    4.54342     0.22   0.824    -7.958061    9.985867
                               |
              ECL#SMALL#c.LLPS |
                          1 1  |   .8756178   .2049257     4.27   0.000     .4709478    1.280288
                               |
                         trend |    .074193   .0428818     1.73   0.086    -.0104863    .1588723
                         _cons |   4.582987   1.645045     2.79   0.006     1.334491    7.831483
              -----------------+----------------------------------------------------------------
                       sigma_u |  12.333291
                       sigma_e |  5.1976587
                           rho |  .84918048   (fraction of variance due to u_i)
              ----------------------------------------------------------------------------------
              Notice that ECL#SMALL#c.LLPS is significant and positive. My interpretation of this is that SMALL=1 has a moderating effect considering that LLPS has a negative impact to begin with but im not really sure if this is the correct interpretation or if further tests are needed. I also notice that the lower order effect of simply LLPS is now not significant to start with and i don't really now how to interperet this. Again, sorry if things are stated incorrectly or likewise... I am a newbie in this forum and in stata.

              Comment


              • #8
                If anyone has feedback as to my question above on the three-way interaction that would be very much obliged!

                Comment


                • #9
                  Again, margins + marginsplot is going to help you here. Interpreting 3-way interactions can be challenging, so use the great Stata tools as an aide. See the very helpful tutorial for 3-way interactions here.

                  Comment


                  • #10
                    Hi tank you, I have read that manual a few times but to start with i have a continous variable in CLPS so i can't run the command -margins ECL#SMALL#CLPS- as CLPS is not a factor variable. In any case my only question regarding my output above is how to interperet the interaction term ECL#SMALL#c.LLPS. I ran the command
                    Code:
                    margins ECL#SMALL, dydx(LLPS)
                    following my regression above with the ouput below.

                    Code:
                    Average marginal effects                        Number of obs     =      3,847
                    Model VCE    : Robust
                    
                    Expression   : Linear prediction, predict()
                    dy/dx w.r.t. : LLPS
                    
                    ------------------------------------------------------------------------------
                                 |            Delta-method
                                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                    LLPS         |
                       ECL#SMALL |
                            0 0  |  -.3596114   .3152482    -1.14   0.254    -.9774864    .2582637
                            0 1  |    -1.1225   .2933382    -3.83   0.000    -1.697432   -.5475676
                            1 0  |   -.987721   .2963176    -3.33   0.001    -1.568493   -.4069493
                            1 1  |  -.8749917   .2943698    -2.97   0.003    -1.451946   -.2980376
                    ------------------------------------------------------------------------------
                    The conclusion i 'want to draw' is that when SMALL=1 it has a moderating effect on the impact of LLPS on SP_3m as the three-way interaction is positive and significant wherease LLPS overall has a negative impact but can i do this based on the three-way interaction alone? If i, for example, run a comparison of the slopes using -pwcompare (effects)- the difference between (ECL=1 SMALL=1) and (ECL=1 SMALL=0) is not significant even thou my three-way interaction is.

                    Code:
                    margins ECL#SMALL, dydx(LLPS) pwcompare(effects)
                    Code:
                    Pairwise comparisons of average marginal effects
                    
                    Model VCE    : Robust                           Number of obs     =      3,847
                    
                    Expression   : Linear prediction, predict()
                    dy/dx w.r.t. : LLPS
                    
                    ---------------------------------------------------------------------------------
                                    |   Contrast Delta-method    Unadjusted           Unadjusted
                                    |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    ----------------+----------------------------------------------------------------
                    LLPS            |
                          ECL#SMALL |
                    (0 1) vs (0 0)  |  -.7628885   .2664182    -2.86   0.004    -1.285059   -.2407184
                    (1 0) vs (0 0)  |  -.6281097   .1815398    -3.46   0.001    -.9839211   -.2722982
                    (1 1) vs (0 0)  |  -.5153804   .3095739    -1.66   0.096    -1.122134    .0913732
                    (1 0) vs (0 1)  |   .1347789   .2920371     0.46   0.644    -.4376034    .7071611
                    (1 1) vs (0 1)  |   .2475081   .1690128     1.46   0.143    -.0837509    .5787672
                    (1 1) vs (1 0)  |   .1127293   .3010241     0.37   0.708    -.4772671    .7027257
                    ---------------------------------------------------------------------------------

                    Comment


                    • #11
                      Any help and suggestions regarding this is greatly appreciated as it is a would-be part of my upcoming thesis...

                      Comment


                      • #12
                        Successful registration. Thanks, Statalist

                        Comment


                        • #13
                          Hi Alexander,

                          I quote famous Williams, R. (2012). Using the margins command to estimate and interpret adjusted predictions and marginal effects. The Stata Journal, 12(2), 308-331.

                          People often ask what the ME of an interaction term is. Stata’s margins command replies: there is not one.
                          As Erik said, margins + marginsplot is going to help. For the threeway interaction I suggest marginal effects at representative values (MER). Quote again:

                          With MERs, you choose ranges of values for one or more independent variables and then see how the MEs differ across that range. MERs can be intuitively meaningful, while showing how the effects of variables vary by other characteristics of the individual.
                          You can use the at() option to specify SMALL=1 or =0. You can do a marginsplot. You can test the difference between SMALL 0 or 1 with mlincom to see if it's statistical significant.

                          Best regards

                          Comment

                          Working...
                          X