Announcement

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

  • Graphically show the interaction effect, panel data

    Hi everyone,

    I am estimating a moderating effect with a random effects regression model and it gives me the results indicated below. As the interaction term shows a significant relationship, I would like to graphically show how this moderating effect evolves on ROE. However, I can only find how to create a margins plot from the two interacting variables, but not the impact on the dependent variable (ROE in this case).

    Hope someone can help!

    Code:
    xtreg ROE_w c.laggedGSCMP##i.laggedEMS Firmrisk_w Firmsize_w i.Industry i.year, re
    
    Random-effects GLS regression                   Number of obs      =      3704
    Group variable: ID                              Number of groups   =       463
    
    R-sq:  within  = 0.0154                         Obs per group: min =         8
           between = 0.0897                                        avg =       8.0
           overall = 0.0301                                        max =         8
    
                                                    Wald chi2(17)      =     95.26
    corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000
    
    -----------------------------------------------------------------------------------------
                      ROE_w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ------------------------+----------------------------------------------------------------
                laggedGSCMP |  -.0513154   .0717939    -0.71   0.475    -.1920287     .089398
                1.laggedEMS |  -.0228706   .0314698    -0.73   0.467    -.0845502    .0388091
                            |
    laggedEMS#c.laggedGSCMP |
                         1  |   .2009424   .0930021     2.16   0.031     .0186617    .3832232
                            |
                 Firmrisk_w |  -.0095493   .0619435    -0.15   0.877    -.1309563    .1118577
                 Firmsize_w |   .0329511   .0083621     3.94   0.000     .0165616    .0493406
                            |
                   Industry |
                         2  |  -.0058314   .0503369    -0.12   0.908      -.10449    .0928272
                         3  |  -.0471294   .0430901    -1.09   0.274    -.1315843    .0373256
                         4  |  -.0536516   .0583197    -0.92   0.358    -.1679561    .0606528
                         5  |  -.1049833   .0432338    -2.43   0.015    -.1897201   -.0202466
                         6  |  -.0863122   .0387198    -2.23   0.026    -.1622017   -.0104227
                            |
                       year |
                      2008  |  -.0465011   .0318643    -1.46   0.144    -.1089541    .0159518
                      2009  |   -.138029   .0318752    -4.33   0.000    -.2005032   -.0755548
                      2010  |  -.0493769   .0318645    -1.55   0.121    -.1118301    .0130763
                      2011  |   -.005929   .0320594    -0.18   0.853    -.0687642    .0569062
                      2012  |  -.0636718   .0320582    -1.99   0.047    -.1265047    -.000839
                      2013  |   .0183746   .0319767     0.57   0.566    -.0442986    .0810477
                      2014  |   .0199688   .0323688     0.62   0.537    -.0434728    .0834105
                            |
                      _cons |  -.0430078   .0740766    -0.58   0.562    -.1881953    .1021797
    ------------------------+----------------------------------------------------------------
                    sigma_u |  .13493434
                    sigma_e |  .48411832
                        rho |  .07208581   (fraction of variance due to u_i)
    -----------------------------------------------------------------------------------------

  • #2
    I'm not sure what you mean by the "impact" on ROE. Where you are interacting a continuous variable with a dichotomy, the plot that people usually want to see is two plots of ROE as a function of the continuous variable, one for each of the values of the dichotomy. You can get that from -margins- and -marginsplot- as

    Code:
    margins laggedEMS, at(laggedGSCMP = (list_of_interesting_values_of_laggedGSCMP))
    marginsplot
    where the list of interesting values of lagged_GSCMP would be some values of lagged_GSCMP that more or less span the range of that variable, and enough of them that the curves come out relatively smooth. (In your model, the "curves" are actually lines, so you could get away with just specifying the min and max of laggedGSCMP here.)

    Another plot that people are sometimes interested in is the marginal effect of the dichotomy as a function of the continuous variable.
    Code:
    margins, dydx(laggedEMS) at(laggedGSCMP = (list_of_interesting_values_of_laggedGSCMP))
    marginsplot
    If neither of these is what you are looking for, please post back with an explanation of what you want on the vertical axis, and what on the horizontal axis, and how you want the resulting curves to be stratified (if you want them stratified).

    Comment


    • #3
      Thank you so much! I think this is what I was looking for, I thought that I needed to specify ROE as my vertical axis somehow, but now I see that Stata uses ROE automatically as linear prediction variable when I use margins after the regression, perfect!

      So these are the results that I get from both commands: In both graphs it can be seen that the interaction effect on ROE increases when the number of adopted green practices (laggedGSCMP) increases. However, could you tell me what the difference is in interpretation of the two graphs? How to make a distinction in interpretation between predictive margins and marginal effects?

      The output of the margins are:
      Code:
      margins laggedEMS, at(laggedGSCMP = (0,0.25,0.5,0.75,1))
      
      Predictive margins                                Number of obs   =       3704
      Model VCE    : Conventional
      
      Expression   : Linear prediction, predict()
      
      1._at        : laggedGSCMP     =           0
      
      2._at        : laggedGSCMP     =         .25
      
      3._at        : laggedGSCMP     =          .5
      
      4._at        : laggedGSCMP     =         .75
      
      5._at        : laggedGSCMP     =           1
      
      -------------------------------------------------------------------------------
                    |            Delta-method
                    |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
      _at#laggedEMS |
               1 0  |   .1043122   .0123615     8.44   0.000     .0800842    .1285402
               1 1  |   .0814416   .0288338     2.82   0.005     .0249285    .1379548
               2 0  |   .0914834   .0174989     5.23   0.000     .0571861    .1257806
               2 1  |   .1188484   .0230526     5.16   0.000     .0736662    .1640306
               3 0  |   .0786545   .0332252     2.37   0.018     .0135344    .1437747
               3 1  |   .1562552   .0283529     5.51   0.000     .1006845    .2118258
               4 0  |   .0658257    .050457     1.30   0.192    -.0330682    .1647196
               4 1  |   .1936619   .0406052     4.77   0.000     .1140771    .2732467
               5 0  |   .0529968   .0680603     0.78   0.436    -.0803988    .1863925
               5 1  |   .2310687   .0553725     4.17   0.000     .1225406    .3395968
      -------------------------------------------------------------------------------
      
      
       margins, dydx(laggedEMS) at(laggedGSCMP = (0,0.25,0.5,0.75,1))
      
      Average marginal effects                          Number of obs   =       3704
      Model VCE    : Conventional
      
      Expression   : Linear prediction, predict()
      dy/dx w.r.t. : 1.laggedEMS
      
      1._at        : laggedGSCMP     =           0
      
      2._at        : laggedGSCMP     =         .25
      
      3._at        : laggedGSCMP     =          .5
      
      4._at        : laggedGSCMP     =         .75
      
      5._at        : laggedGSCMP     =           1
      
      ------------------------------------------------------------------------------
                   |            Delta-method
                   |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      1.laggedEMS  |
               _at |
                1  |  -.0228706   .0314698    -0.73   0.467    -.0845502    .0388091
                2  |    .027365   .0273467     1.00   0.317    -.0262335    .0809636
                3  |   .0776006   .0398311     1.95   0.051    -.0004668    .1556681
                4  |   .1278363   .0592145     2.16   0.031      .011778    .2438945
                5  |   .1780719   .0806683     2.21   0.027     .0199649    .3361788
      ------------------------------------------------------------------------------
      Note: dy/dx for factor levels is the discrete change from the base level.
      Click image for larger version

Name:	Screenshot 2019-04-20 at 08.57.52.png
Views:	1
Size:	44.1 KB
ID:	1494228
      Click image for larger version

Name:	Screenshot 2019-04-20 at 09.01.10.png
Views:	1
Size:	40.0 KB
ID:	1494229

      Comment


      • #4
        The predictive margins, shown in the first graph, are the model's predicted values of ROE itself. The marginal effects, shown in the second graph, are the differences in predicted values of ROE between the laggedEMS = 0 and laggedEMS = 1 groups.

        By the way, -marginsplot- accepts pretty much all of the options available in -graph twoway-, so if you want to explicitly label the vertical axes in these graphs so that they mention ROE and delta ROE, respectively, the -ylabel()- option is available to you. Indeed, you can modify the style and aesthetics of these graphs any way you would be able to with any Stata two-way graph.

        Take some time to get more familiar with the -margins- command. The best introduction I know of is the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf, which gives a lucid explanation along with many worked examples, some of which are quite similar to your problem.

        Comment


        • #5
          Thank you so much! I have one last question; from the predictive margins graph it shows that when EMS=0, an increase in adopted GSCM practices results in a decrease in ROE. I'm not sure how to interpret this, is it the same as the effect of GSCMP on ROE in absence of an EMS? Because when I regress laggedGCMP on ROE (with control variables) it shows no significant effect and a positive coefficient. Maybe I'm mixing things up now..

          Comment


          • #6
            Because when I regress laggedGCMP on ROE (with control variables) it shows no significant effect and a positive coefficient. Maybe I'm mixing things up now..
            I don't know how to interpret this description of what you did. If you show the actual code and outputs you got I'd be happy to give you my interpretation and reconcile it with whatever other analysis you did.

            In any case, yes, what your interaction model in #3 predicts is that when laggedEMS = 0 (is that what you mean by "absence of an EMS") increases in laggedGCMP are associated with decreases in ROE.

            Comment


            • #7
              This is the code and output that I get when regressing laggedGSCMP on ROE, without considering EMS. As is shows a positive and nonsignificant results it does not correspond to the graph that shows a negative relationship between laggedGSCMP and ROE. Therefore, I'm not sure how to interpret the negative association in the graph as this is not reflected in the regression results.
              (I indeed meant by absence of EMS, EMS=0).

              Thank you for your help!

              Code:
               xtreg ROE_w laggedGSCMP Firmrisk_w Firmsize_w i.Industry i.year, re
              
              Random-effects GLS regression                   Number of obs      =      3704
              Group variable: ID                              Number of groups   =       463
              
              R-sq:  within  = 0.0276                         Obs per group: min =         8
                     between = 0.1328                                        avg =       8.0
                     overall = 0.0572                                        max =         8
              
                                                              Wald chi2(15)      =    161.46
              corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000
              
              ------------------------------------------------------------------------------
                     ROE_w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
               laggedGSCMP |   .0191466   .0343004     0.56   0.577    -.0480808    .0863741
                Firmrisk_w |  -.0631295   .0448929    -1.41   0.160     -.151118    .0248591
                Firmsize_w |   .0395318   .0060429     6.54   0.000      .027688    .0513755
                           |
                  Industry |
                        2  |  -.0392955   .0395083    -0.99   0.320    -.1167304    .0381394
                        3  |  -.0350991   .0338529    -1.04   0.300    -.1014495    .0312512
                        4  |  -.0548755   .0459446    -1.19   0.232    -.1449253    .0351743
                        5  |  -.0904948    .033978    -2.66   0.008    -.1570904   -.0238992
                        6  |  -.0833837   .0303134    -2.75   0.006    -.1427969   -.0239706
                           |
                      year |
                     2008  |  -.0528606    .020314    -2.60   0.009    -.0926754   -.0130458
                     2009  |  -.1022114   .0202994    -5.04   0.000    -.1419975   -.0624252
                     2010  |  -.0125072   .0203009    -0.62   0.538    -.0522964    .0272819
                     2011  |   .0230118   .0204369     1.13   0.260    -.0170439    .0630674
                     2012  |  -.0261506   .0204476    -1.28   0.201    -.0662271    .0139259
                     2013  |   .0182056   .0203893     0.89   0.372    -.0217567     .058168
                     2014  |   .0412205   .0204448     2.02   0.044     .0011494    .0812916
                           |
                     _cons |  -.1082921   .0544724    -1.99   0.047    -.2150559   -.0015282
              -------------+----------------------------------------------------------------
                   sigma_u |  .13281134
                   sigma_e |  .30863761
                       rho |   .1562398   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------

              Comment


              • #8
                The results you show in #7 are from a model that does not include the EMS variable at all. Consequently, it does not tell you anything about what happens when EMS = 0, nor anything about what happens when EMS = 1. It tells you what happens for a population that is a mix of EMS = 0 and EMS = 1. If you were to graph the results in a way similar to what you did in #3, the graph would more or less fall in between those graphs.

                There is no inconsistency between these results and what you had in #3. Those graphs are specifically about the EMS = 0 and EMS = 1 cases.

                Comment


                • #9
                  Of course, makes sense now. Many thanks for your help Clyde!

                  Comment

                  Working...
                  X