Hi All,

I have the following regression equation. I am trying to see the interaction effect of a binary variable (gender) on both my linear term (counter) and quadratic terms (counter_sq)

reg Y x1 x2 x3 c.counter##i.gender c.counter_sq##i.gender i.month, robust


I have used the following command

margins, at(counter =(-4958 0 4958) gender=(0 1))

marginsplot, noci x(counter)

1. When I run the following code with both the square term and moderator (i.e. c.counter_sq##i.gender) and the linear term and moderator (c.counter##i.gender) I don't see a variation in the graph with the gender. However, when I remove the quadratic term and the interaction (c.counter_sq##i.gender) and used only the linear term and moderator (c.counter##i.gender) then it worked.

2. Further, when I try to only see the effect of quadratic term and the interaction (c.counter_sq##i.gender) I don't see any variation of gender (i.e. I see one line and not two lines for both values of 0 and 1 for gender).

margins, at(counter_sq =(-4958 0 4958) gender=(0 1))

marginsplot, noci x(counter_sq)


Please suggest how to proceed.

My intention is to interpret the results of the interaction term and linear and quadratic term. Apart from the coefficients I also intend to see it in a graph.