Announcement

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

  • How to test for significance of the cumulative effect in regressions with interaction terms?

    Dear Statalist Members,

    I have a question on how to check for a significant relationship between an explanatory variable and the dependent variable if I also include an interaction term in my regerssion.

    For example:
    reg y x1 x2 x1*x2

    x2 is a dummy and I am interested in the effect of x1 if x2 = 1. Let's assume the coefficient for x1 is not significant, but the one of the interaction term is significant. How can I test whether the overall effect of x1 is significant if x2 = 1?
    Is test(x1*x2 = x1 =0) the correct approach?

    Any comments are highly appreciated.
    Best,
    Lisa

  • #2
    That command does not test the hypothesis you want to test.

    Your models is:

    y = b0 + b1 x1 + b2 x2 + b3 x1 x2 + e

    You can rewrite that equation as follows:

    y = b0 + (b1 + b3 x2 ) x1 + b2 x2 + e

    So the effect of x1 is:

    (b1 + b3*x2)

    So when x1 = 1, the effect of x2 is

    (b1 + b3 * 1) = b1 + b3

    So to test whether the effect of x1 is 0 when x2 is 1 you type in Stata something like

    test x1 + x1*x2= 0

    x1*x2 is obviously not a correct variable name, you need to change that as appropriate for your model.

    Alternatively you can get those results directly by using the tricks discussed in this Stata tip: http://maartenbuis.nl/publications/ref_cat.html
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Because the test has one degree of freedom, I prefer obtaining a t statistic and a confidence interval. One way to do this is,

      reg y x1 x2 c.x1#c.x2
      lincom x1 + c.x1#c.x2

      assuming that c.x1#c.x2 is the name of the interaction given to Stata in the output. Note that "c" here means to treat the variables as continuous, but it gives the correct answer. You can replace c.x2 in the reg command with i.x2, but then you need to use the name given to the interaction in the lincom command.

      Comment


      • #4
        Thanks a lot to both of you! I really appreciate that.
        I tried both tests and they yield the same results overall.

        Comment


        • #5
          Can't you also use the dydx option on the margins command doing dydx on x1 if x2=1 ?

          Comment

          Working...
          X