I am running a model with interactions, and I am trying to plot the interaction plot; however, the legend is being weird leaving off one symbol. Does anyone know what is going on? Not only is there no symbol for the 0 Count group, all of the other colors don't map to the correct group. I don't want to use the graph editor because I need to create many similar graphs, so I would like to be able to code it directly. Appreciate the help.


Variable Definitions:
Bill: Continuous (0,650)
Treatment: Binary 0,1
Count: Counting the frequency of something occurring (0,1,2,3+)
Time: Continuous (0,500)
Variable Definitions:
Bill: Continuous (0,650)
Treatment: Binary 0,1
Count: Counting the frequency of something occurring (0,1,2,3+)
Time: Continuous (0,500)
Code:
tpm bill i.treatment i.treatment##i.count i.treatment##c.time, f(logit) s(glm,family(gamma) link(log))
margins, at(time=(0(50)500) count=(0 1 2 3) treatment=(0))
marginsplot, noci title("Control Group: Time Variable and Count Variable") xtitle("Time (weeks)", margin(medium)) ytitle("Bill", margin(medium)) graphregion(col(white)) ylabel(0(200)600, labsize(small)) xlabel(0(100)500, labsize(small))
marginsplot, noci title("Control Group: Time Variable and Count Variable") xtitle("Time (weeks)", margin(medium)) ytitle("Bill", margin(medium)) graphregion(col(white)) ylabel(0(200)600, labsize(small)) xlabel(0(100)500, labsize(small)) legend(on order(0 " 0 Count" 1 "1 Count" 2 "2 Count" 3 "3+ Counts"))

Comment