Announcement

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

  • Average Marginal Effects in logit model

    Dear Statalist Users

    this being my first post I hope to include all important information.

    I am running a binary logit model with an interaction term between two factor variables (including the command i.gender## i.education in the model) in Stata 14.1.

    Because of the problem of unobserved heterogeneity I want to report my results using average marginal effects (AME).
    For this I am using (after running the .logitstic)
    .margins, dydx (_all)

    If I would have an interaction between two variables and one is continuous I could visualize the interaction in a graph like margins plot.
    But what can I do with a interaction between two factor variables like gender and education levels?

    In other words:
    Is there a option to compute AME for interaction terms between two factor variables and what is the corresponding stata command?

    Thank you for your help

  • #2
    The value of the interaction term can’t change independently of the values of the component terms, so you can’t estimate a separate AME for the interaction. Vince Wiggins had a nice discussion of this at

    http://www.stata.com/statalist/archi.../msg00293.html

    What you may want to do instead is compute predicted values for different values of your independent variables, e.g. something like

    Code:
    webuse nhanes2f, clear
    logit diabetes i.race i.female, nolog
    margins race#female
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Another way to represent the interaction effects for discrete variables would be:

      Code:
      margins, dydx(education) at(gender = (0 1)) // ASSUMING gender IS CODED 0/1
      which would give gender-specific marginal effects of education.

      Comment


      • #4
        Thank you so much for your help.
        Now it has become more clear to me.

        Comment


        • #5
          There is one more question about interaction terms in logit models and AME.

          When I compute predicted values for each combination of gender and education to get an overview about gender-specific marginal effects of education I get different results if I add the interaction-term to logit model or not.

          One thing didn´t quite become clear to me:
          In which way influences the added interaction term in the logit model the predicted AME for the sub-groups (.margins gender#education)?


          Comment


          • #6
            When I compute predicted values for each combination of gender and education to get an overview about gender-specific marginal effects of education I get different results if I add the interaction-term to logit model or not.
            Well, of course. The model with interaction is a different model from the one without interaction. So you should expect them to make different predictions. Specifically, the model without interaction terms is a framework in which there is a single effect of gender that applies without regard to education level, and there is a single effect of (each level of) education that applies equally to both genders. By contrast, in the model with an interaction term, the effect of gender depends on the education level, and vice versa. The non-interaction model is subject to these equality-of-effect constraints that are relaxed in the interaction model.

            If the interaction term's coefficient is small, and if there is no, or only very weak, a priori reason to believe that the effects of gender depend on education (and vice versa), then you could consider the no-interaction model to be a reasonable, and simpler, way to view the data. But if the interaction term coefficient is appreciable, then the simpler no-interaction model is an inferior fit to the data, and I would rely on the model with interaction.

            In which way influences the added interaction term in the logit model the predicted AME for the sub-groups (.margins gender#education)?
            The output of -margins gender#education- does not give the predicted AME for the subgroups. It gives the predicted probabilities of your outcome in each of the subgroup. To get the subgroup specific AME's, the code in #3 is applicable (as is the same code with the roles of gender and education interchanged).

            Comment


            • #7
              Dear Clyde Schechter, I am reviving this post because I have a similar situation. My question is: given I use a code similar to the code in #3

              Originally posted by Clyde Schechter View Post
              Another way to represent the interaction effects for discrete variables would be:

              Code:
              margins, dydx(education) at(gender = (0 1)) // ASSUMING gender IS CODED 0/1
              which would give gender-specific marginal effects of education.
              can I interpret it as I would interpret the average marginal effect for the whole sample?


              Suppose I get something like

              Code:
              . margins female, dydx(lwage)
              
              Average marginal effects                        Number of obs     =        689
              Model VCE    : OIM
              
              Expression   : Pr(rl), predict()
              dy/dx w.r.t. : lwage
              
              -------------------------------------------------------------------------------
                            |            Delta-method
                            |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
              --------------+----------------------------------------------------------------
              lwage        |
                    female |
                Male  |  -.0404456   .0278203    -1.45   0.146    -.0949723    .0140812
              Female  |   .0719544   .0181675     3.96   0.000     .0363468    .1075619
              -------------------------------------------------------------------------------
              can I interpret it as the AME when holding the gender at zero (i.e., when gender is "Male") and one (i.e., when gender is "Female") respectively?

              In other words, can I say that:
              1.
              - the average change in the probability when the wage increases is not significantly different from zero FOR MALE.
              - but the average change in the probability when the wage increases by about 10% is 0.007, or 0.7 percentage points, FOR FEMALE.

              Or would that be more precise to say that:
              2.
              - the average change in the probability when the wage increases is not significantly different from zero WHEN TREATING THE SAMPLE AS MALE (i.e., holding "female" at zero)
              - but the average change in the probability when the wage increases by about 10% is 0.007, or 0.7 percentage points, WHEN TREATING THE SAMPLE AS FEMALE (i.e., holding "female" at one)

              Or neither of them?

              Comment


              • #8
                Well, before we get to the issue of wording, let me point out that the marginal effects being calculated here correspond go a unit increase in the variable lnwage. A unit increase in lnwage (assuming lnwage is, as its name suggests, the natural logarithm of wage) corresponds to a multiplicative increase in wage by a factor of e (approx 2.72). So the wage increase involved here is actually 172%, not 10%.

                That said, your second version would be a more accurate description than the first. Nevertheless, for better or for worse, we usually are not quite that precise when actually writing reports so we typically say something closer to your first answer, even though we mean the second. The phrasing that I typically use is: "When adjusted to the sample distribution of other model covariates, the average change in probability is about 7 percentage points for females and -4 percentage points for males." I would usually amplify this a bit by also mentioning the confidence intervals. I am not a big fan of p-values and statistical significance, so I usually would not comment on those aspects of it--but that shouldn't necessarily stop you from doing so.

                Hope this helps.

                Comment


                • #9
                  Dear Clyde Schechter , thank you for your quick reply!

                  I forgot to mention that I considered multiplying the average marginal effect by .10 and then obtaining the average change in the probability when lnwage increases by about 10%, following the comment in this Statalist post:

                  https://www.statalist.org/forums/forum/general-stata-discussion/general/1307299-interpreting-marginal-effects-for-logged-variable

                  Comment

                  Working...
                  X