Announcement

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

  • Marginsplot categorical x continuous interaction

    Dear all,

    I am running the following model in Stata 13
    Code:
    glm Y_time1  i.X##c.Y_time0  c.T i.B c.D , family(poisson) link(log)
    . I am modeling an interaction between a continuous variable c.Y_time0 and the categorical variable i.X, which only takes values of 0 or 1.
    Click image for larger version

Name:	ytime0andX.png
Views:	1
Size:	11.7 KB
ID:	1445738




    After -marginsplot, this is the graph I obtained:

    Click image for larger version

Name:	marginsplot image x y0.png
Views:	1
Size:	28.3 KB
ID:	1445740



    But, I am not sure how to interpret the image as the sign of the interaction is negative and none of these lines is decreasing.
    I am sorry for the basic questions, but I really appreciate any help.

    Thank you.
    Last edited by Erika Gonzalez; 24 May 2018, 12:50.

  • #2
    Can you add your actual margins command?

    Comment


    • #3
      It would have been helpful to show the actual -margins- command, too. But I think I can figure out from the graph itself what is going on. I think you simply ran -margins X, at(Ytime_0 = (100(200)1900))- or something equivalent to that. What you are graphing there are the predicted values of Y_time_1 at the various values of X and Y. Both lines are upsloping because:

      The slope of the graph for X = 0 is given by the coefficient of Ytime_0, which is positive.

      The slope of the graph for X = 1 is given by the coefficient of Ytime_0 + the interaction coefficient, which, though closer to zero because the interaction coefficient is negative, is nevertheless still positive.

      The negative coefficient of the interaction term says that the slope of the graph for X = 1 will be less steep than that of the graph for X = 0 (which is, indeed, what you see in the graph). It does not imply that either line will be downsloping. You would get a downsloping graph for X = 1 if the interaction coefficient were both negative and larger in magnitude than the Ytime_0 coefficient. In that case the sum of the interaction coefficient and the Ytime_0 coefficient would be negative, and the X = 1 graph would slope downward.

      Added: Crossed with #2.

      Comment


      • #4
        I am sorry, I mistakenly deleted the command for marginsplot, but it's pretty much what Clyde said. Thank you so much. This is definitely very helpful.

        Best,
        Erika

        Comment

        Working...
        X