Announcement

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

  • Plot of simple slopes

    Hi,
    I have some trouble with generating a plot of simple slopes.
    My model looks like this: y = a0 + a1*X + a2*Z + a3*XZ + e, whereby X is my independent variable and Z is the moderator (both are continuous).

    What I want to depict is the interaction effect of the two variables, but onlny with two lines: one for a low level of Z (one standard deviation below mean) and one for a high level of Z (one standard deviation above mean).

    Is there a command with which I can plot this graph directly with the results of the regression?

    Hope you can help me!
    Best regards
    Last edited by Sebastian M; 09 May 2015, 01:20.

  • #2
    See margins and marginsplot

    Example:

    Code:
    sysuse auto,clear
    qui {
        sum weight
        local at1 = r(mean) + r(sd)
        local at2 = r(mean) - r(sd)
        reg mpg c.length##c.weight
        margins, at(length = (150(10)250) weight = (`=`at1'' `=`at2'' ) )
    }
     marginsplot, noci

    Comment

    Working...
    X