In Stata, I am using the coefplot
package to try and plot one coefficient from multiple regressions (in other words, there will be multiple coefficients, but each one comes from a different regression) on the same plot.
Here is code (related to Plotting same coefficient over time) that accomplishes this when the coefficients have the same name in each regression:
ssc install coefplot
sysuse auto, clear
estimates clear
regress price mpg if foreign==0
est sto t1
regress price mpg if foreign==1
est sto t2
regress price mpg if rep78==5
est sto t3
coefplot t1 || t2 || t3, drop(_cons) vertical bycoefs yline(0)
This is all fine and dandy. But how can I accomplish the same thing when the coefficient from each regressions relates to a different variable? For example:
estimates clear
regress price mpg if foreign==0
est sto t1
regress price trunk if foreign==1
est sto t2
regress price weight if rep78==5
est sto t3
coefplot t1 || t2 || t3, drop(_cons) vertical bycoefs yline(0)
This produces three separate plots when I want just one plot. What do I need to do to accomplish this? What I would like is for there to be one plot with the coefficients from mpg
(t1
), truck
(t2
), and weight
(t3
) all plotted on the same plot. It would be good to know also how to switch between labeling these coefficients mpg, truck, weight
and t1, t2, t3
.
One solution is to use a matrix, but I would like to avoid going down this route if possible.