Announcement

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

  • Problems with term of interaction and margins command

    Dear Stata Users,

    I have a question on the margins command.

    I have the following (truncated) output from the regression specified below.

    I put an interaction term that interests me.
    The interaction term (in bold) appears to be statistically significant.


    . svy: logit event1 i.tercile2##i.sex i.wave5 i.livingpar i.ukborn i.sex i.educ2 if marital==1&age>17&
    > age<36&evunion==2&jbstat!=7&ivfioall==1, level(90)

    (running logit on estimation sample)

    Survey: Logistic regression

    Number of strata = 1,533 Number of obs = 27,624
    Number of PSUs = 4,751 Population size = 28,042.993
    Design df = 3,218
    F( 11, 3208) = 21.47
    Prob > F = 0.0000


    Linearized
    event1 Coef. Std. Err. t P>t [90% Conf. Interval]

    1.tercile2 .7687752 .1038346 7.40 0.000 .5979332 .9396171

    sex
    Female .6165134 .122423 5.04 0.000 .4150874 .8179394

    tercile2#sex
    1#Female -.3718655 .1352367 -2.75 0.006 -.5943741 -.1493568



    - When I run margins in this way, the interaction term is not significant anymore.

    margins r.tercile#r.sex, level(90) post atmeans
    outreg2 using margisex, word replace eform level(90) label

    ------------------------------------------------
    | df F P>F
    -------------+----------------------------------
    tercile2#sex | 1 2.06 0.1511
    Design | 3218
    ------------------------------------------------
    Note: F statistics are adjusted for the survey
    design.

    ----------------------------------------------------------------------------
    | Delta-method
    | Contrast Std. Err. [90% Conf. Interval]
    ---------------------------+------------------------------------------------
    tercile2#sex |
    (1 vs 0) (Female vs Male) | -.0145494 .0101309 -.031218 .0021192
    ----------------------------------------------------------------------------


    Thus, I am asking myself whether this is the right way to get the marginal effect of an interaction term.

    Could you please confirm me if this is the case ?

    Thank you.
    Best,
    Lydia

  • #2
    There is no right way to get the marginal effect of an interaction term. Interaction terms don't have marginal effects. There simply is no such thing. From your model it is possible to estimate several marginal effects:

    1. The marginal effects of tercile2, conditional on each value of sex.
    2. The marginal effects of sex, conditional on each value of tercile2.
    3. Average marginal effects of tercile2, averaged across both sexes.
    4. Average marginal effects of sex, averaged across all values of tercile2.

    Those are the only marginal effects available in your model.

    What is it you are trying to calculate and are mistakenly calling the marginal effect of the interaction? If you can explain in words what that is, perhaps there is code to calculate it.

    Comment


    • #3
      Thank you for answering.

      I am interested in how the effect of tercile2 on event1 varies according to the sex of the individual (logit event1 i.sex i.tercile2 i.sex##i.tercile2 )

      Later I will also be interested in how the effect of tercile2 on event1 varies according to sex and age of the individual (so three-way interaction), expressed into age groups
      as a categorical variable (logit event1 i.sex i.tercile2 i.sex##i.tercile2##i.agegr)

      The reason why I am using the contrast operator is to find whether the different effects are significant or not.

      Comment


      • #4
        I am interested in how the effect of tercile2 on event1 varies according to the sex of the individual (logit event1 i.sex i.tercile2 i.sex##i.tercile2 )
        You can get that with
        Code:
        margins sex, dydx(tercile2)
        If you are interested specifically in the difference between those two effects, you can add the -pwcompare- option to the -margins- command.

        Later I will also be interested in how the effect of tercile2 on event1 varies according to sex and age of the individual (so three-way interaction), expressed into age groups as a categorical variable (logit event1 i.sex i.tercile2 i.sex##i.tercile2##i.agegr)
        The code for that will be
        Code:
        margins sex#agegr, dydx(tercile2)
        and, again, you can add the -pwcompare- option to that if you want to focus on the differences among those.


        Comment


        • #5
          Thank you. This seems what I really was looking for. I have one last question. Should I keep the interaction term in the specification of the model?

          I would say yes, as margins would not modify my model, as if there were an interaction inside, but I would like to be sure about that.

          Thank you very much again.

          Comment


          • #6
            Yes, I would definitely keep the interaction term in this model. It's coefficient is around half the size of the "main" effects of sex and tercile alone, so there is clearly a lot of effect modification going on. A model without the interaction term would be rather misleading here.

            Comment

            Working...
            X