I would like to seek help in margins plot. I searched the forum but could not find the answer.
I wanted to have a graph similar like this, looking at the effect of chronic conditions depend on mental health and income group on outcomes. Array
I tried two sets of code but were unable to make it.
The first one
Code:
xtreg score i.chronic##i.Depr i.age gender i.edu i.income margins, at(Depr = (0/1) chronic = (0/3) ) over(income) marginsplot, xdimension(chronic income ) recast(scatter) recastci(rspike) /// legend(order(1 "no depression " 2 " depression " )) /// ciopts(lc(black)) /// plot1opts(msymbol(D) mcolor("gs0") msize(small) ) /// plot2opts(msymbol(D) mcolor("gs10") msize(small) ) /// xtitle("number of chronic diseases", margin(3 0 3 3) ) ytitle("score") /// xlabel( 2.5 "0" 6.5 "1" 10.5 "2" 14.5"3+")
Array
The second one
Code:
xtreg score i.chronic##i.Depr i.age gender i.edu i.income margins, at(Depr = (0/1) chronic = (0/3) ) over(income) marginsplot, xdimension(chronic ) recast(scatter) recastci(rspike) /// legend(order(1 "no depression Q4" 2 "no depression Q3" 3 "no depression Q2" 4 "no depression Q1" /// 5 "depression Q4" 6 "depression Q3" 7 "depression Q2" 8 "depression Q1" )) /// ciopts(lc(black)) /// plot1opts(msymbol(D) mcolor("gs0") msize(small) ) /// plot2opts(msymbol(D) mcolor("gs5") msize(small) ) /// plot3opts(msymbol(D) mcolor("gs10") msize(small)) /// plot4opts(msymbol(D) mcolor("navy") msize(small)) /// plot5opts(msymbol(O) mcolor("gs0") msize(small)) /// plot6opts(msymbol(O) mcolor("gs5") msize(small)) /// plot7opts(msymbol(O) mcolor("gs10") msize(small)) /// plot8opts(msymbol(O) mcolor("navy") msize(small)) /// xtitle("chronic diseases", margin(3 0 3 3) )
And I got. So wondering if I can change markers position?
Array
Many thanks in advance.
Cheers,
Tianxin
0 Response to marginsplot (interaction plot) change marker position or symbols
Post a Comment