Announcement

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

  • Regression with Interaction Terms and Post-Estimation Interpretation

    Dear Statalist community,

    I am running the following code to initially generate a regression output:
    Code:
    xtreg y c.a##c.b $controlvariables i.fyear, fe
    This code generates the following with control variables and year output omitted for simplicity:
    Code:
    Fixed-effects (within) regression               Number of obs     =     11,363
    Group variable: gvkey                           Number of groups  =      1,547
    
    R-squared:                                      Obs per group:
         Within  = 0.4145                                         min =          1
         Between = 0.3950                                         avg =        7.3
         Overall = 0.4009                                         max =         12
    
                                                    F(24,9792)        =     288.80
    corr(u_i, Xb) = -0.4448                         Prob > F          =     0.0000
    
    -------------------------------------------------------------------------------------
                      y | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------------+----------------------------------------------------------------
                      a |  -.8820247    1.37278    -0.64   0.521    -3.572956    1.808907
                      b |  -.1120089    .110937    -1.01   0.313    -.3294683    .1054504
                        |
                c.a#c.b |   6.042615   2.489008     2.43   0.015     1.163646    10.92158
                        
      
                  _cons |     13.749   1.191463    11.54   0.000     11.41348    16.08451
    --------------------+----------------------------------------------------------------
                sigma_u |  4.8700768
                sigma_e |  2.9240485
                    rho |  .73502736   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------------
    F test that all u_i=0: F(1546, 9792) = 2.86                  Prob > F = 0.0000

    Then, i run some post-estimation commands to generate an interaction plot.

    margins, at(b=(0(1)1) a =(0 1))

    Predictive margins Number of obs = 11,363
    Model VCE: Conventional

    Expression: Linear prediction, predict()
    1._at: a = 0
    b = 0
    2._at: a = 0
    b = 1
    3._at: a = 1
    b = 0
    4._at: a = 1
    b = 1

    ------------------------------------------------------------------------------
    | Delta-method
    | Margin std. err. z P>|z| [95% conf. interval]
    -------------+----------------------------------------------------------------
    _at |
    1 | 9.605668 .028179 340.88 0.000 9.550438 9.660898
    2 | 9.493659 .1150657 82.51 0.000 9.268134 9.719184
    3 | 8.723643 1.379275 6.32 0.000 6.020313 11.42697
    4 | 14.65425 2.704182 5.42 0.000 9.354149 19.95435
    ------------------------------------------------------------------------------

    marginsplot
    Above margins code generates the following marginsplot
    Please see attached for graph

    I have the following questions!

    1. The regression output shows coefficient of 13.749. In the margins command output, I was expecting the 13.749 to match where a =0 and b = 0 where the main standalone variables are zero. However, this does not seem to be true also in the marginsplot as well. Would this be because i am including control variables as well as fixed effects?

    2. Based on the regression output, the effect of a depends on the value(s) b but not by themselves. I am having a little bit of trouble understanding the economic magnitude of the coefficients. Can I add the interaction coefficient to the intercept as the total effect?

    3. If the interpretation in #2 is correct, then can I graph this out somehow where I can show the interaction term's 6.04 coefficient in the graph? In other words, if the intercept of 13.749 "increases" by 6.04 (interaction term coefficient), can this increase be visualized in Stata?

    Thank you so much,
    Attached Files

  • #2
    1. The regression output shows coefficient of 13.749. In the margins command output, I was expecting the 13.749 to match where a =0 and b = 0 where the main standalone variables are zero. However, this does not seem to be true also in the marginsplot as well. Would this be because i am including control variables as well as fixed effects?
    That is correct. Those things would agree in a simple model with no other variables, but here they cannot be expected to agree.

    Can I add the interaction coefficient to the intercept as the total effect?
    No. Adding the interaction coefficient to the intercept will give you a number that has no meaning whatsoever.

    I do not know what you mean by "the total effect." I suspect you don't either, because in an interaction model there is no such thing. By using an interaction model you are stipulating that a and b each have infinitely many different effects on y, depending on the values of the other. If you would like to see the average marginal effect of a, you could do that with:
    Code:
    margins, dydx(a)
    Similarly for the average marginal effect of b. If you are interested in the marginal effect of a at specific values of b (for instance, at b = 0 and b = 1) then you can do
    Code:
    margins, dydx(a) at (b = (0 1))
    But there is nothing that can be called "the total effect."

    Comment


    • #3
      Thank you Clyde for your response!

      I wanted to confirm my understanding of the regression result - for now, it seems that there is no meaningful interpret that that could be obtained by the mean-centered a and b. That said, the coefficient on the interaction term is 6.04 (p<0.05) which tells me that, as you mentioned, a and b have different effects on y depending on the values of the other.

      Then, does the coefficient on the interaction term 6.04 actually mean anything other than that given its p-value, there is some interaction effect between a and b?

      Thank you,

      Comment


      • #4
        The coefficient of the interaction term quantifies how much the effect of a depends on b (and vice versa). So with a value of 6.4, we can say that a unit difference in the value of b is associated with a 6.04 difference in the marginal effect of a. (Or vice versa). Or, in purely mathematical terms, given that a and b are both continuous, the coefficient is the mixed second partial derivative of y with respect to a and b. (d2y/da db, where we should be using the curly d instead of the Roman d.)

        given its p-value, there is some interaction effect between a and b?
        I will spare you my long rant on why this kind of thing is an egregious misuse of p-values. Suffice it to say that it is never correct to say that a significant vs non-significant p-value distinguishes an existent vs non-existent effect of any kind. Even though I have little doubt that is what you were taught. The mis-transformation of continuous p-values into dichotomous yes/no verdicts is a widely mistaught fallacy that has resulted in the pollution of the scientific literature with garbage. End of abbreviated rant.

        Comment


        • #5
          Hi Clyde,

          Thank you once again for your reply and thank you for your explanation on the misuse of p-values - I will refrain from making dichotomous decisions just by looking at the p-value.

          May I ask one last question regarding the meaning of 6.4 if b was an indicator variable and a is a continuous variable?

          Based on your post, and also based on Jaccard&Turisi (2003), the interpretation of the interaction variable is the slope (marginal effect) difference for y onto a at b = 0 vs b = 1. That is, the coefficient of 6.04 would be the mean difference in slope between two groups "b" = 0 vs. "b" = 1 given a one-unit increase in "a"

          Then, we have the intercept of 13.74 that has practically no meaning but would decrease by 0.112 (coefficient on b) when b is equal to 1 while a = 0 thereby resulting in 13.74-0.112 = 13.628
          The moderating effect then would be -0.882 (coefficient on a) and 6.04 (coefficient on ab) = 6.04-0.882 = 5.15. Would this value be the mean difference in slope between two groups "b" = 0 vs., "b" =1 given a one-unit increase in "a"?

          My apologies in advance if I misunderstood your post!

          Thank you,


          Comment


          • #6
            You can figure these all out with some simple equations:

            Code:
            marginal effect of b on y, conditional on a == -.112 + 6.043*a
            marginal effect of a on y, conditional on b == -.882 + 6.043*b
            Whether the variables and b are continuous, discrete, or one of each, these equations will always give the correct results. If you are interested in the difference of two marginal effects, just calculate each one and do the subtraction.

            In particular the difference between the marginal effect of a (i.e. what happens to y with a unit increase in a) between b = 0 and b = 1 is -8.882 + 6.043*0 and -8.882 + 6.043*1, and if you subtract those you get 6.043.

            The number 5.15 = 6.04-0.882 fits these equations as the marginal effect of a on y conditional on b = 1.

            While I encourage you to explore these equations to get a feeling for them and an understanding for the meaning of the terms in the interaction model, I would always recommend that you leave the actual calculation of marginal effects to the -margins- command. While it is not too hard to get your head around a simple two-way interaction model with some practice, even people with a lot of experience and a good understanding will make mistakes when trying to do this for more complicated models with multiple interaction terms or higher-order interactions.

            Comment


            • #7
              Thank you so much Clyde for your insights and expertise!
              Much appreciated!

              Comment

              Working...
              X