Announcement

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

  • Predicted probabilities of interaction terms

    I am trying to calculate predicted probabilities of interaction terms, and I used the following commands but am getting errors.

    Firthlogit y a b c.c##I.(d e)

    margins c#d#e, atmeans expression (invlogit(predict(xb)))
    factor c not found in list of covariates

    margins c.c#d#e, atmeans expression (invlogit(predict(xb)))
    only factor variables and their interactions are allowed


    I also tried the other numerous commands for weeks but there is only one command that seems to work.

    Firthlogit y a b c.c##I.(d e)

    margins d , at( c =(min (10) max)) vsquish atmeans expression (invlogit(predict(xb)))

    marginsplot, x(c)



    Can anyone tell me if the command is correct for calculating the predicted probabilities of interaction terms, and if not what do I need to do?

    Thank you very much in advance.


  • #2
    There is no such thing as the predicted probabilities of an interaction term. But there are predicted probabilities from the interaction model at designated values of the interacting variables. And that is what your code calculates. It will give you, for each value of the variable d, a series of predicted probabilities (of y = 1 outcome, with a, b, and e held constant at their means) at values of c from the minimum to the maximum of c, spaced by 10. And the subsequent -marginsplot- command will graph them, with c on the horizontal axis. The graph will be a series of curves, one for each value of d. This kind of graph is often called an interaction plot, and it is probably the simplest, most helpful, and commonest ways to visualize an interaction model. I imagine it is what you meant by "the predicted probabilities of the interaction term."

    Comment


    • #3
      Thank you for the clarification!

      Comment


      • #4
        Hello,

        I am a beginner and I am also struggling with margins.
        I would like to analyse a three-way interaction between dependent variables of a time-series criss-sectional regression (where x2 x3 are independent variables numerical non-integer) with the following code:

        . regress FirmValue c.x1##c.x2##c.x3

        . margins c.x1#c.x2#c.x3
        only factor variables and their interactions are allowed

        Do you know how can I solve this error?

        I would like to get as a final output a marginsplot chart that shows how my variables x2 and x3 above (high) and below (low) their respective median affect the dependent variable, with x1 displayed on x-axis in a range between -s.d. 0 +s.d. and dependent variable on y-axis, showing lines in the chart like this:
        - high x1, high x2
        - high x1, low x2
        - low x1, high x2
        - low x1, low x2.

        Thank you in advance for your answer!

        Comment

        Working...
        X