Is there a package in Stata that can generate a stacked coefficient plot like this one shown below? My dataset is from a survey that asks people to rate on a scale of 0-100 about 35 different groups (e.g. evangelical, immigrant, police, etc). I want to compare the average rating different groups of people like Democrat/Republican, Men/Women gave of the 35 different groups. I've run a simple OLS regression [GROUP FEELING THERMOMETER] ON PARTYID[DEMOCRAT=1, REPUBLICAN=0] followed by marginsplot, but it's just one chart.
*Marginplot
foreach var in Women_2019x1 {
regress `var' demgop [aweight=weight2_2019]
margins, over(demgop)
marginsplot, horizontal recast(scatter) title(`: variable label `var'') xline(0) xscale(range(0100))
}
I've tried Combomarginsplot but it creates separate graphs, not a stacked one.
foreach var in Women_2019x1 {
regress `var' demgop [aweight=weight2_2019]
margins, over(demgop) saving(file1, replace)
* margins, dydx(*) post
marginsplot, horizontal recast(scatter) title(`: variable label `var'') xline(0) xscale(range(0100))
}
combomarginsplot file1 file2, labels ("Women" "Men") by(demgop)
I've tried coefplot, but it holds the results in the constant (linear prediction) without labels identifying which group is rating which of the 35 survey items.
foreach var in Women_2019x1 bw_2019x1 ft_black_2017x1 Democrats_2019x1 ft_jew_2017x1 ft_asian_2017x1 ft_gays_2016x1 hw_2019x1 ft_hisp_2017x1 ft_immig_2016x1 ww_2019x1 rbw_2019x1 pbw_2019x1 cities_2019x1 bm_2019x1 hm_2019x1 Men_2019x1 bc_2019x1 ft_muslim_2017x1 ft_christ_2017x1 towns_2019x1 pww_2019x1 wr_2019x1 pbm_2019x1 rbm_2019x1 hc_2019x1 wm_2019x1 pwm_2019x1 rww_2019x1 wc_2019x1 ft_evang_2017x1 rwm_2019x1 wec_2019x1 Republicans_2019x1 {
regress `var' if demgop==1 [aweight=weight2_2019]
est store `var'1
regress `var' if demgop==0 [aweight=weight2_2019]
est store `var'2
}
coefplot Women_2019x11 Women_2019x12 bw_2019x11 bw_2019x12 ft_black_2017x11 ft_black_2017x12 Democrats_2019x11 Democrats_2019x12 ft_jew_2017x11 ft_jew_2017x12 ft_asian_2017x11 ft_asian_2017x12 ft_gays_2016x11 ft_gays_2016x12 hw_2019x11 hw_2019x12 ft_hisp_2017x11 ft_hisp_2017x12 ft_immig_2016x11 ft_immig_2016x12 ww_2019x11 ww_2019x12 rbw_2019x11 rbw_2019x12 pbw_2019x11 pbw_2019x12 cities_2019x11 cities_2019x12 bm_2019x11 bm_2019x12 hm_2019x11 hm_2019x12 Men_2019x11 Men_2019x12 bc_2019x11 bc_2019x12 ft_muslim_2017x11 ft_muslim_2017x12 ft_christ_2017x11 ft_christ_2017x12 towns_2019x11 towns_2019x12 pww_2019x11 pww_2019x12 wr_2019x11 wr_2019x12 pbm_2019x11 pbm_2019x12 rbm_2019x11 rbm_2019x12 hc_2019x11 hc_2019x12 wm_2019x11 wm_2019x12 pwm_2019x11 pwm_2019x12 rww_2019x11 rww_2019x12 wc_2019x11 wc_2019x12 ft_evang_2017x11 ft_evang_2017x12 rwm_2019x11 rwm_2019x12 wec_2019x11 wec_2019x12 Republicans_2019x11 Republicans_2019x12 ///
,legend(off)
Is there another package in Stata that could produce this stacked coefficient plot of means by group? Thanks very much in advance for your help.
There is a package called multicoefplot which permits to plot multiple models within the same window. Try
ssc install multicoefplot