Maria Palma
Maria Palma

Reputation: 15

Plotting multiple models grouped by coefficients

I am trying to plot a categorical variable from 4 different models using coefplot.

my code is as follows:

reg outcome i.cat if T==1
estimates store M0 

reg outcome i.cat if T==2
estimates store M1 

reg outcome i.cat if T==3
estimates store M2 

reg outcome i.cat if T==4
estimates store M3 

coefplot (M0, label("< 1 yr")) (M1, label("1-2 yrs")) (M2, label("3-4 yrs")) (M3, label("5+ yrs")), keep(*.cat) reform vertical recast(bar) barw(0.2) ciopts(recast(rcap)) graphregion(col(white)) bgcol(white) yline(1) 

and it results in the following graph: enter image description here

but I want the graph to be grouped by cat (the independent variable) and for M0, M1, M2 and M3 to appear in the legend.
An example I produced in excel is the following:

enter image description here

Upvotes: 0

Views: 19

Answers (0)

Related Questions