Announcement

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

  • Graphing Interaction Effect

    I have a linear regression model for which I want to account for an interaction effect.
    The basic model is
    Code:
    regress fp g u i
    With the interaction effects:
    Code:
    regress fp c.g##schanc c.i##schanc c.u##schanc
    What I'm looking for, is a way to graph the effect of schanc on the basic model. My question is, whether it is possible to create a graph for the whole model, akin to one looking only at one variable, e.g.:
    Code:
    regress fp c.u##schanc
    margins, at(u=(1.3(.1)9.1) schanc=(0 1))
    marginsplot, recast(line) addplot(scatter fp u)
    Attached is the respective output. Click image for larger version

Name:	Graph.jpg
Views:	1
Size:	148.4 KB
ID:	1454944

    I hope this isn't to elementary of a question, I've looked for a similar question via the search function but didn't find anything that answered mine. Thank you.

  • #2
    Hi Martin,

    I think what you're looking for is essentially overlaying two models in a marginsplot:
    -One with the interaction effect
    -A second model without the interaction effect.

    Essentially, what you need to do is run those two regression models -> Save the results -> Graph them in a single marginsplot.

    There's an SSC plugin for stata which allows you to do this. It's discussed in this thread: https://www.statalist.org/forums/for...wo-marginsplot

    Does that help you?

    Comment


    • #3
      Hi Jesse,
      my question was probably wrong, but your answer solved what i was asking for anyways - overlaying two regression models is exactly what I needed! The plugin helped.
      Thanks very much!
      Last edited by Martin Gabriel; 26 Jul 2018, 08:19.

      Comment


      • #4
        That's nice to hear

        Comment

        Working...
        X