Hi Statalist,
I was trying to use coefplot, to combine an predictor's coefficients, estimated from two models. Basically I want to compare the effect size of this predictor in different models. below are the scripts I wrote, in which I hope to color the coeffects and the CIs in different colors from different models.
I could not seem to find a solution that combines both outputs: (1) ylabel: "Domestic Cars" and "Foreign Cars"; (2) different colors for the two coefficients and CIs.
I also tried to add color options in Solution 1: things like below, but that color options apply to all graphs, instead of subgraph D
I wonder if I miss anything here? Please advise
Any comments or directions are much appreciated!
Thanks!!
I was trying to use coefplot, to combine an predictor's coefficients, estimated from two models. Basically I want to compare the effect size of this predictor in different models. below are the scripts I wrote, in which I hope to color the coeffects and the CIs in different colors from different models.
Code:
sysuse auto, clear
regress price mpg trunk length turn if foreign==0
estimates store D
regress price mpg trunk length turn if foreign==1
estimates store F
*Solution 1: the ylabel is perfect; however I could not color D an F differently
coefplot D, bylabel(Domestic Cars) ///
|| F, bylabel(Foreign Cars) ///
||, bycoefs keep(mpg)
*Solution 2: the colors can be re-coded; however, ylabel is not correct
coefplot (D, bcolor(grey)) ///
(F, bcolor(green)), ///
keep(mpg) legend(off)
I also tried to add color options in Solution 1: things like below, but that color options apply to all graphs, instead of subgraph D
Code:
coefplot D, bylabel(Domestic Cars) mcolor(green) ///
|| F, bylabel(Foreign Cars) ///
||, bycoefs keep(mpg)
Any comments or directions are much appreciated! Thanks!!

Comment