Announcement

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

  • 3-way interaction terms (categorical#categorical#continuous)

    Hi,

    I appreciate advice on interpreting a 3-way interaction between two categorical and 1 continuous variable. I ran system GMM and later ran margins command to find the slope of interaction term but the results appear to be different from what I calculated. Can someone please help on how to interpret a 3-way interaction term and their slopes?
    Attached Files
    Last edited by Zeenat Murtaza; 04 Sep 2023, 11:55.

  • #2
    You're probably not going to like my answer. And others may chime in with contrary recommendations, too. But here's my honest opinion about this.

    You are working with a complicated model because it has not just one three-way interaction, but several of them involving some of the same variables. It is possible to calculate marginal effects from these coefficients, but it is not at all straightforward. Any marginal effect involving CRISIS or CA must take into account the values of not only the other, but also the values of AGE, SIZE, and INT. It is further complicated by the fact that your model, although it contains three-way interaction terms lacks the included two-way sub-interaction terms. (That is, there is no CRISIS#CA, CRISIS#AGE or AGE#CA to go with CRISIS#AGE#CA, etc.) This absence makes the interpretation of the coefficients even more complicated.

    To get a correct calculation requires meticulous attention to detail and making sure that all and only the necessary terms are included. It is a task for which humans are poorly suited and, frankly, I recommend not even trying. Just rely on -margins- to get reliably correct results. (If you are doing this not for results but to develop your understanding and skills at working with interactions, choose a less complicated example.)

    Comment


    • #3
      Three-way interactions are challenging. I personally don't interpret them without a tool such as margins and marginsplot. Without access to your data, I ran a model using the nlsw88 data to show how I would approach it.

      Code:
      use https://www.stata-press.com/data/r16/nlsw88
      
      poisson wage i.collgrad##i.union##c.hours c.ttl_exp, vce(robust)
      
      note: you are responsible for interpretation of noncount dep. variable
      
      Iteration 0:   log pseudolikelihood = -4846.7698  
      Iteration 1:   log pseudolikelihood = -4846.7645  
      Iteration 2:   log pseudolikelihood = -4846.7645  
      
      Poisson regression                              Number of obs     =      1,877
                                                      Wald chi2(8)      =     908.45
                                                      Prob > chi2       =     0.0000
      Log pseudolikelihood = -4846.7645               Pseudo R2         =     0.1058
      
      ----------------------------------------------------------------------------------------
                             |               Robust
                        wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -----------------------+----------------------------------------------------------------
                    collgrad |
               college grad  |   .3309412   .1549413     2.14   0.033     .0272618    .6346206
                             |
                       union |
                      union  |   .4657259   .1675307     2.78   0.005     .1373718      .79408
                             |
              collgrad#union |
         college grad#union  |   .3689741    .281798     1.31   0.190    -.1833399    .9212881
                             |
                       hours |   .0035567   .0017727     2.01   0.045     .0000823    .0070311
                             |
            collgrad#c.hours |
               college grad  |   .0022298   .0038839     0.57   0.566    -.0053825    .0098421
                             |
               union#c.hours |
                      union  |  -.0076013   .0041915    -1.81   0.070    -.0158164    .0006139
                             |
      collgrad#union#c.hours |
         college grad#union  |   -.012409   .0067663    -1.83   0.067    -.0256707    .0008527
                             |
                     ttl_exp |   .0409107   .0024382    16.78   0.000     .0361318    .0456895
                       _cons |   1.191026   .0670294    17.77   0.000     1.059651    1.322401
      ----------------------------------------------------------------------------------------
      Interpreting interactions from regression tables is difficult. So let's use margins:

      Code:
      margins collgrad#union, at(hours = (15(5)50))
      Predictive margins                              Number of obs     =      1,877
      Model VCE    : Robust
      
      Expression   : Predicted number of events, predict()
      
      1._at        : hours           =          15
      
      2._at        : hours           =          20
      
      3._at        : hours           =          25
      
      4._at        : hours           =          30
      
      5._at        : hours           =          35
      
      6._at        : hours           =          40
      
      7._at        : hours           =          45
      
      8._at        : hours           =          50
      
      ----------------------------------------------------------------------------------------------
                                   |            Delta-method
                                   |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -----------------------------+----------------------------------------------------------------
                _at#collgrad#union |
      1#not college grad#nonunion  |   5.966333   .2563574    23.27   0.000     5.463882    6.468785
         1#not college grad#union  |   8.481095   .8342509    10.17   0.000     6.845993     10.1162
          1#college grad#nonunion  |   8.589336   .7693921    11.16   0.000     7.081355    10.09732
             1#college grad#union  |   14.65919   1.744842     8.40   0.000     11.23936    18.07902
      2#not college grad#nonunion  |   6.073384   .2110872    28.77   0.000     5.659661    6.487107
      ...
      A plot will help tremendously:
      Code:
      marginsplot
      graph export three-way.png
      Click image for larger version

Name:	image_32170.png
Views:	1
Size:	157.1 KB
ID:	1725988
      We have four groups formed by the combinations of the two dichotomous variables and we can now talk about and contrast these groups as the continuous variable increases or decreases.
      Last edited by Erik Ruzek; 04 Sep 2023, 12:28.

      Comment


      • #4
        .
        Last edited by Zeenat Murtaza; 04 Sep 2023, 15:01.

        Comment


        • #5
          Dear Clyde & Erik,

          I am truly grateful to both of you for your kind and courteous response. I'll follow these instructions but I am confused about one thing. Why did stata omit one of the interaction term result in Crisis#Age#CA & Crisis#Size#CA? Is this related to application of instrument based technique GMM ? Also, if the effect of 2 individual variable is negative but one is positive and the effect of 3 way interaction is positive; does this mean the interaction of 3 strengthens the negative effect of variables. Please advise.
          Last edited by Zeenat Murtaza; 04 Sep 2023, 15:06.

          Comment


          • #6
            As you do not show your code or output from the regression, one can only speculate about why you got the specific results you did or how to interpret them.

            But, in general terms, when you have two dichotomous variables like crisis and ca, their total interaction consists of four possible combinations of the two variables' values. In regression when there are n levels of something, they get represented by n-1 indicator variables: one category is left out as the reference (base) level. So you should expect to see a total of three indicators in the output for the interaction of crisis and ca. If you did the conventional representation of the interaction as crisis##ca, you will get one level for crisis, one for ca, and one for crisis#ca. If you did the less conventional crisis#ca representation, then you will have no levels for crisis or ca alone but three levels for crisis#ca. If you did something even more unconventional like crisis crisis#ca (but no ca term) you will get one level for crisis and two levels for crisis#ca (one of which will go unmentioned as the baseline, and the other will be marked as (omitted) and given a coefficient of 0). The fact that in your model you further interact with a continuous variable doesn't change this calculation.



            Comment


            • #7
              Thank you so much Clyde for your expert advise and detailed explanation; I got where I made the mistake. Thank you once again for your valuable time and advice. God bless you for this courtesy and kindness.

              Comment


              • #8
                Hi,

                I worked through the models again and ran commands hopefully correctly this time. But, I am confused why the coefficients in margins results are significant for some when the main table gives insignificant results while for some the results are significant in main table after running GMM but the margins table is showing insignificant. Can you please help with interpretation why this is so and how to interpret it?

                Attached Files

                Comment


                • #9
                  There is no reason that the results should be the same, or even similar in any prescribed way, as they are different things.

                  For example, in the regression output, the coefficient called 1.crisis represents the marginal effect of crisis conditional on all variables that appear in any interaction term that includes crisis being 0. In the margins output, the result for 1.crisis is the marginal effect of crisis averaged over all combinations of variables that appear in any interaction term.

                  Comment


                  • #10
                    Thank you so much Clyde. I appreciate your prompt and courteous response. It clearly makes sense to me now. Thank you once again.

                    Comment

                    Working...
                    X