Hi!
I would love to get some help with how to visualize my interaction. I have been using this stata manual of twoway contour (https://www.stata.com/stata-news/news32-1/spotlight/). But the problem is that my graph does not show any curvature but only straight lines, making me wonder if it does not show the interaction (see picture). I use an education variable with six levels, and an income variable with 12. Can't see why my graph would differ. There is a significant interaction term. Happy for any advice!

reg outcomevar income education c.education#c.income
quietly margins, at(education=(1(1)6) income=(1(1)12)) saving(predictions, replace)
use predictions, clear
list _at1 _at2 _margin in 1/5
rename _at1 education
rename _at2 income
rename _margin pr_outcomevar
*reg outcome c.education##c.income
twoway contour pr_outcomevar income education, ccuts(0(0.2)5.0)),
xlabel(1(1)6)
ylabel(0(1)12, angle(horizontal))
xtitle("Education (categories)")
ytitle("Income")
Best,
Marcus
I would love to get some help with how to visualize my interaction. I have been using this stata manual of twoway contour (https://www.stata.com/stata-news/news32-1/spotlight/). But the problem is that my graph does not show any curvature but only straight lines, making me wonder if it does not show the interaction (see picture). I use an education variable with six levels, and an income variable with 12. Can't see why my graph would differ. There is a significant interaction term. Happy for any advice!
reg outcomevar income education c.education#c.income
quietly margins, at(education=(1(1)6) income=(1(1)12)) saving(predictions, replace)
use predictions, clear
list _at1 _at2 _margin in 1/5
rename _at1 education
rename _at2 income
rename _margin pr_outcomevar
*reg outcome c.education##c.income
twoway contour pr_outcomevar income education, ccuts(0(0.2)5.0)),
xlabel(1(1)6)
ylabel(0(1)12, angle(horizontal))
xtitle("Education (categories)")
ytitle("Income")
Best,
Marcus
Comment