Announcement

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

  • marginal effects of two continuous variables after login model

    Dear all,
    I am searching an answer to my enquiry but haven't found a clear answer yet searching the forum. Could anyone enlighten me if possible, please? Here is my question:
    Model:
    Y = constant + X1 + X2 +X3 + Z + X1*Z + X2*Z + X3*Z + error
    X1, X2, X3 and Z are continuous variables. Y is a dummy.
    The direct estimated coefficients from xtlogit is not interpretable, and odds ratio appears difficult to interpret. My question is, if I want to report marginal effects for individual variables (i.e. X1, X2, X3 and Z) and their interaction terms (X1*Z, X2*Z, and X3*Z), how can I do that?

    I think probably the marginal effects of the three interaction terms should be generated by:
    average marginal effect of the interaction term X1*Z:
    . margins, expression(normalden(xb())*(_b[Z] + X1*_b[c.X1#c.Z])) dydx(X1)
    average marginal effect of the interaction term X2*Z:
    . margins, expression(normalden(xb())*(_b[Z] + X2*_b[c.X2#c.Z])) dydx(X2)
    average marginal effect of the interaction term X3*Z:
    . margins, expression(normalden(xb())*(_b[Z] + X3*_b[c.X3#c.Z])) dydx(X3)

    How to generate marginal effects of the individual variables X1, X2, X3 and Z?
    What I want is not:
    . margins, dydx(X1)
    because this gives the same marginal effects as the marginal effects of X1 using:
    . margins, dydx(*)
    which will already take into account of the marginal effects from interaction terms. However, what I want is marginal effects of the individual variables X1, X2, X3 and Z.

    Thank you very much.

  • #2
    If you use factor variable notation, then your margins is much much easier.
    logit c.x1 c.x2 c.x3 c.z c.x1#c.z c.x2#c.z c.x3#c.z

    margins , dydx(x1) at(z=(0 1 2)) assuming 0 1 2 are reasonable values for z.

    Given the interaction, there is no marginal effect of x1 without setting the value of z.

    x2 and x3 are obvious. The marginal effect of z depends on the values of x1 x2 and x3. However, we often don't do it both ways.

    margins , dydx(z) at(x1=0 x2=0 x3=0) at(x1=1 x2=3 x3=4)) You have to pick reasonable combinations of the x values.

    With logit, it is often illuminating to look at the straight margins (predicted values) instead of dydx.

    margins , at(x1=(0(1)5) z=(0 2))


    marginsplot after the margins command then is very useful.

    Comment


    • #3
      Dear Phil,
      Thank you so much for your clear explanation. This is very helpful and is exactly what I'm looking for. Many thanks indeed.
      In my paper, I think it's probably the best to report both the margins and marginsplot. Thanks a lot for your advice.
      Best wishes,
      Meng Song

      Comment

      Working...
      X