Announcement

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

  • Graphing cross-level interaction

    Hello,

    I'm using Stata 13 to graph the interaction shown in the following code:

    xtreg rrpcm3 c.c_schcomp##c.c_studcomp bie_sch pctlep pctabsnt pcttchabsnt pcttchlft pctschlnch pctspeced ///
    prepare2 prepare3 prepare4 dsex race lep iep slunch zprofcmp teachyrs2 teachyrs3 teachyrs4 deg2 ///
    suburb town rural, cluster(schid)

    The mean of the outcome variable is around 216. Both the predictors are continuous and centered at the mean. The interaction itself is cross-level.

    Here's what I'm doing to graph my interaction:

    margins, dydx(c_schcomp) at(c_studcomp=(-10(5)15)) vsquish
    margins, at(c_schcomp=(-40 30) c_studcomp=(-10(5)15)) vsquish
    marginsplot, noci x(c_schcomp) recast(line) xlabel(-40(10)30)

    I could alternatively use this: mcp c_schcomp c_studcomp, at1(-40(10)30) at2(-10(5)15) mar(atmeans)

    The graph below is produced.



    Isn't it the case that the linear predictions from the plot produced should start near the mean from the regression equation?

    Thanks in advance for any help you can offer.

    Diego

  • #2
    Since I didn't get a response yet, I'm including the output from the commands I listed in my previous post. I've also attached the marginsplot graph. Maybe that will help folks understand what I'm asking.

    My question is: Why don't the trajectories begin near the intercept that the xtreg command spit out given the small coefficient for either of the two continuous variables I am interacting?
    Attached Files

    Comment


    • #3
      Well, first of all, unless all of your variables are centered at their means, the regression intercept is not the same as the mean outcome value. It is the mean outcome value conditional on all predictor variables being zero.

      I'm guessing that the only variables you have centered are c_schcomp and c_studcomp. So the margins you calculated will reflect the effects of all those other variables as well as the intercept.

      To be clear, I am not suggesting that you center every variable and rerun the analyses. That may or may not be a sensible thing to do in your situation. The centering of schcomp and studcomp is important because you are focusing on them and, above all, on their interaction. Centering the other variables may or may not matter depending on what else you intend to do. I'm just saying that if you don't center them, then your expectation that the mean outcome should equal, or even approximate, the regression intercept is incorrect.
      Last edited by Clyde Schechter; 04 Mar 2015, 14:34.

      Comment


      • #4
        Thanks, Clyde. Gotcha. I appreciate the clarification.

        Comment

        Working...
        X