Announcement

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

  • Question on comparing coefficients of main effect and interaction term

    Dear Statalists,

    I am estimating a model with interaction terms, like y=a+bx+cz+dx*z, where x is a continuous variable and z is a dummy variable. Assums both b(the coefficient of the continuous variable) and d(the coefficient of the interaction term) are significant. I think that b is the effect of x on y when z=0, and d is the difference in the effect of x on y between z=0 and z=1. So can I say that the effect of x on y (when z=1) is equal to b+d?

    Many thanks!

  • #2
    Alex:
    the intuition behind your statement is correct.
    However, I would advise you to give a more copmprehensive picture of what's going on in your regression results with numbers, instead of a description.
    After -regress- I usually invoke -predict- and then compare its results to the fitted values for a handful of observations calculated by hand, just to be sure I've got everything right and I'm able to explain what I have obtained to any audience:
    Code:
    sysuse auto.dta
    . reg price c.mpg##i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(3, 70)        =      9.48
           Model |   183435281         3  61145093.6   Prob > F        =    0.0000
        Residual |   451630115        70  6451858.79   R-squared       =    0.2888
    -------------+----------------------------------   Adj R-squared   =    0.2584
           Total |   635065396        73  8699525.97   Root MSE        =    2540.1
    
    -------------------------------------------------------------------------------
            price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
              mpg |  -329.2551   74.98545    -4.39   0.000    -478.8088   -179.7013
                  |
          foreign |
         Foreign  |  -13.58741   2634.664    -0.01   0.996    -5268.258    5241.084
                  |
    foreign#c.mpg |
         Foreign  |   78.88826   112.4812     0.70   0.485    -145.4485     303.225
                  |
            _cons |   12600.54   1527.888     8.25   0.000     9553.261    15647.81
    -------------------------------------------------------------------------------
    
    . bysort foreign: list price mpg foreign fitted if _n==1
    
    -----------------------------------------------------------------------------------------------------------------------
    -> foreign = Domestic
    
         +-----------------------------------+
         | price   mpg    foreign     fitted |
         |-----------------------------------|
      1. | 4,099    22   Domestic   5356.926 |
         +-----------------------------------+
    
    -----------------------------------------------------------------------------------------------------------------------
    -> foreign = Foreign
    
         +----------------------------------+
         | price   mpg   foreign     fitted |
         |----------------------------------|
      1. | 9,690    17   Foreign   8330.715 |
         +----------------------------------+
    
     
    . mat list e(b)
    
    e(b)[1,6]
                              0b.           1.  0b.foreign#   1.foreign#            
                mpg      foreign      foreign       co.mpg        c.mpg        _cons
    y1   -329.25507            0   -13.587408            0    78.888255    12600.538
     
     
    
    . di 12600.538 + 22*[-329.25507+(78.888255*0)] + (-13.587408*0)
    5356.9265
    
    . di 12600.538 + 17*[-329.25507+(78.888255*1)]+ (-13.587408*1)
    8330.7147
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      Thank you very much. The following is the relevant part of my result, where x is the continuous variable and z is the dummy variable. I am using System GMM (xtabond2), and thus I manually created the interaction term, rather than using factor notation (this is because xtbond2 has a bug with factor notation, as suggested by Sebastian Kripfganz).

      The interaction term x_z is significant. Then, I use -margins, at(x=(0(1)10) z=(0 1)), marginsplot- to visualize the interaction effect, but I got two parallel lines (z=1 and z=0) for the fitted values corresponding to each value of x (as shown in the graph attached).

      So may I ask why the graph does not show the interaction effect (since parallel lines indicate the absence of interaction effect)?

      Moreover, if the main effect of the continuous variable x is not significant but the interaction term is significant (let's say a negative sign), can I interpret it as that the effect of x on y is weaker when z=1?

      Many thanks again!

      Code:
            x |   .0682939   .0141848     4.81   0.000     .0404921    .0960957
            z |   .3285615   .1158541     2.84   0.005     .1014916    .5556315
          x_z |  -.0390286   .0178219    -2.19   0.029    -.0739589   -.0040983
      Click image for larger version

Name:	x_z.png
Views:	1
Size:	157.4 KB
ID:	1451390
      Last edited by Alex Mai; 01 Jul 2018, 05:50.

      Comment


      • #4
        Alex:
        the main issue with your data is the interaction created by hand, which -marginsplot- does not recognize as an interaction between z and x, as you can see by running the following toy-example:
        Code:
        sysuse auto.dta
        reg price i.foreign##c.displacement
        margins foreign, at(displacement =(70(50)450))
        marginsplot
        
        g foreign_displacement=foreign*displacement
        reg price i.foreign c.displacement foreign_displacement
        margins foreign, at(displacement =(70(50)450))
        marginsplot
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Alex:
          the main issue with your data is the interaction created by hand, which -marginsplot- does not recognize as an interaction between z and x, as you can see by running the following toy-example:
          Code:
          sysuse auto.dta
          reg price i.foreign##c.displacement
          margins foreign, at(displacement =(70(50)450))
          marginsplot
          
          g foreign_displacement=foreign*displacement
          reg price i.foreign c.displacement foreign_displacement
          margins foreign, at(displacement =(70(50)450))
          marginsplot
          Dear Carlo,

          Thank you very much! I have tried using factor notation and the -marginsplot- clearly shows the interaction effect (let aside the bug with factor notation in -xtabond2-).

          And can I ask how to interpret the result if the main effect is not significant and the interaction term is significant? Just like the following case, where the continuous variable x is insignificant itself, but its interaction with the dummy z is significant.

          Can I say that the impact of x on y is weaker or reduced if z=1?

          Thank you!

          Code:
               x |   .0075207   .0049261     1.53   0.127    -.0021343    .0171757
               z |
              0  |          0  (empty)
              1  |   .1672452   .0898878     1.86   0.063    -.0089316     .343422
           z#c.x |
              0  |          0  (empty)
              1  |  -.0160327    .008311    -1.93   0.054     -.032322    .0002565
          Click image for larger version

Name:	Graph1.png
Views:	1
Size:	133.6 KB
ID:	1451394

          Comment


          • #6
            Alex:
            as per your outcome, interaction seems barely significant (see the 95% CI) and -marginsplot- shows it by reducing the distance between -z=0 and --z=1- as -x- values increase.
            Last edited by Carlo Lazzaro; 01 Jul 2018, 08:45.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Originally posted by Carlo Lazzaro View Post
              Alex:
              as per your outcome, interaction seems barely significant (see the 95% CI) and -marginsplot- shows it by reducing the distance between -z=0 and --z=1- as -x- values increase.
              Dear Carlo,

              Thank you very much! However, may I ask the relationship between the p-value of main effect/interaction term reported in the regression table and the 95% CIs in the margin graph?

              I find that in some cases (like the graph in this thread) the 95% CIs overlaps across all values for interaction term with p=0.054, while in some other cases the 95% CIs does not overlap across almost all values for interaction term with similar p-value or even p-value beyond 0.1.

              If the 95% CIs does not overlap across x between 0 and 50 but overlaps across x between 51 and 100, is it correct to say that there is interaction effect for x from 0 to 50, but no interaction effect for x from 51 to 100?

              Thank you very much again!
              Last edited by Alex Mai; 01 Jul 2018, 10:26.

              Comment


              • #8
                Alex:
                the issue you're interested in is (partailly) covered in Example 5: Margins with interaction terms, -margins- entry, Stata .pdf manual.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Originally posted by Carlo Lazzaro View Post
                  Alex:
                  the issue you're interested in is (partailly) covered in Example 5: Margins with interaction terms, -margins- entry, Stata .pdf manual.
                  Thank you very much once more! May I just ask a last thing? I have seen some confusing explanations about this point. With significant interaction term but insignificant main effect x, do you think which of the following two statements is correct?
                  A. x has significant impact on y when z=1, and does not have significant impact on y when z=0.
                  B. x may not have significant impact on y when z=1, but the magnitude or direction of the (perhaps insignificant) impact of x on y differs between z=0 and z=1.

                  Perhaps my question can be summarised as whether or not the statistical significance of the main effect determines the interpretation of the interaction term.

                  Sorry for taking your time!
                  Last edited by Alex Mai; 01 Jul 2018, 11:33.

                  Comment


                  • #10
                    Alex:
                    part of the confusion rests on the fact that, when an interaction term is added, there's no (more) such a thing as main effect on the terms included in the interaction itself, but the usual definition is conditional (on interaction) main effects.
                    That said, I would feel more comfortable with your B. option.
                    As an aside, you may want to -contrast- -margins- at different values of your continuous variable.
                    See also: https://www.statalist.org/forums/for...its-or-margins
                    Last edited by Carlo Lazzaro; 01 Jul 2018, 11:51.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Originally posted by Carlo Lazzaro View Post
                      Alex:
                      part of the confusion rests on the fact that, when an interaction term is added, there's no (more) such a thing as main effect on the terms included in the interaction itself, but the usual definition is conditional (on interaction) main effects.
                      That said, I would feel more comfortable with your B. option.
                      As an aside, you may want to -contrast- -margins- at different values of your continuous variable.
                      See also: https://www.statalist.org/forums/for...its-or-margins
                      Many thanks again! I get your point. Perhaps my use of "main effect" is not very suitable, I just refer to the two component variables themselves individually.
                      My concern is that the interpretation of the interaction effect is conditional on the coefficient of the individual component variable. So if the coefficient of the individual component variable is not statistically significant (for z=0, x does not impact on y), then the impact of x on y when z=1 should not be considered as significant even if the interaction term is significant.
                      In this regard, the significant interaction term may, at most, be interpreted as a signal of the differential impact of x on y between z=0 and z=1.

                      Comment

                      Working...
                      X