Announcement

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

  • Rebecca Ivester
    started a topic Marginsplot and interaction

    Marginsplot and interaction

    Hi all--I am trying to use marginsplot to graph my interactions. I have got it to work successfully when I only have a linear interaction term, but I cannot figure out a way to use marginsplot to graph interactions once I include a squared term. Does anyone have advice?

    Only a linear interaction term:
    Code:
     eststo: areg `var' prop_same_gender c.prop_same_race##i.race_3_s              
                            
                    margins race_3_s, dydx(prop_same_race)
                    quietly margins race_3_s, at(prop_same_race=(0(.1)1))
                    marginsplot, noci recast(line) ytitle("") title("`title'") legend(size(vsmall))
    Regression with squared interaction term:
    Code:
     eststo: areg `var' prop_same_gender c.prop_same_race##i.race_3_s c.prop_same_race_sq##i.race_3_s

  • Rebecca Ivester
    replied
    Brilliant! Thank you

    Leave a comment:


  • Scott Merryman
    replied
    Use factor variables to create squared variable and interactions with other variable:

    Code:
    sysuse auto,clear
    reg price c.mpg##c.mpg##i.fore
    qui margins fore, at(mpg=(10(1)40))
    marginsplot

    Leave a comment:

Working...
X