Announcement

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

  • Margins command - Interaction term

    Hi,

    I don't have much experience with the margins command yet and face a problem interpreting the marginal effect of an interaction term.

    Suppose a OLS regression model with a continuous variable A and a categorical variable B as well as an interaction term c.A##i.B.

    The coefficients of both variables A and B do not differ significantly from 0 whereas the interaction coefficient takes on the value .28 and is significant at the 5% level. I am interested in the effect of A on Y.

    As to my understanding, A has only a significant influence on Y if B takes on the value 1. In this case (B=1), an increase of A by 1 results in an increase of Y by 0.28.

    The following command:

    Code:
    margins, dydx(A) at( A = .9602147 B= 1)
    results in:

    Code:
    Average marginal effects                                 Number of obs = 2,404
    Model VCE: Robust
    
    Expression: Linear prediction, predict()
    dy/dx wrt:  A
    At: B =        1
        A = .9602147
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
       A         |    .179922   .0720446     2.50   0.013     .0385429    .3213011
    ------------------------------------------------------------------------------
    I am interested in the change of Y by a change in A, given that B = 1.

    My question is why the coefficient of the interaction term in the regression analysis differs from the marginal effect. Which of the two is the actual effect I am looking for?

    Any help is much appreciated!
    Last edited by Klaus Klausen; 27 Jul 2022, 06:27.

  • #2
    The coefficient of c.A#1.B in the regression output is not the marginal effect of anything. It is the difference between the marginal effect of A when B == 1 and the marginal effect of A when B == 0.

    The average marginal effect of A when B = 1 is given by the output of some command similar to -margins, dydx(A) at(B=1)-. As you do not show the original regression you ran, I do not know whether A also appears elsewhere in the model (e.g. interaction of A with other variables, or powers of A). If A does not appear elsewhere, then the marginal effect of A will depend on B, and only on B, so the specification of A = .9602147 in the -at()- option is unnecessary (but also does no harm): it is equivalent to -margins, dydx(A) at(B=1)- and the average marginal effect of A at B = 1 is the one and only marginal effect of A at B = 1. But if A does have other entanglements in the regression model, then the marginal effect may also depend on the value of A, and in that case, the average marginal effect of A at B = 1 would typically differ from the marginal effect of A at B = 1 and some specified value of A.

    Comment


    • #3
      Thank you Clyde, that is really helpful. A and B only occur as single variables and in the interaction term c.A##i.B.

      Comment

      Working...
      X