Hi all,
I am trying to do regression analysis in STATA and I want to include the quadratic term for my IV. I am trying to see what might be the most elegant way to do this. Posting two options below - should I expect different answers from these models?
Step 2 is to test a moderation effect on this main effect. I have also included the proposed code for this in each option. For step 2, I also wanted to enquire how to plot the interaction between a quadratic IV term and a linear moderator term in STATA.
I am trying to do regression analysis in STATA and I want to include the quadratic term for my IV. I am trying to see what might be the most elegant way to do this. Posting two options below - should I expect different answers from these models?
Step 2 is to test a moderation effect on this main effect. I have also included the proposed code for this in each option. For step 2, I also wanted to enquire how to plot the interaction between a quadratic IV term and a linear moderator term in STATA.
Code:
//option 1 gen ivsq=iv*iv //creating a square term reg dv ivsq iv reg dv c.iv##c.mod c.ivsq##c.mod // adding a moderator - it works but I feel uncomfortable about this lol //option 2 reg dv c.iv##c.iv //self moderation reg dv c.iv##c.iv##c.mod //looks better to me! Would be great to confirm and learn how to plot this.
Comment