Dear Statalist,
I have a query about editing the output of a graph. I have some estimates that compare the outcomes of two separate treatment arms to a control group (Treat = group1,group2). The estimates themselves are then saved in separate matrices (matrix A and B), then plotted together for each outcome. Naturally, coefplot accomplishes this task. However, the default is that coefplot will plot each input (matrix) side by side. Is it possible to edit the position of the estimates so that they are stacked/aligned/on the same x-coordinate rather than side by side? Ideally, one of the group of estimates would be shifted to the left (to align with the value marker) and the other would be shifted to the right (to do the same).
Below, I have generated some code similar to my own using some sysuse data. The resulting figure is below as well.
I'm stumped here, so hopefully, someone has some good idea!

I have a query about editing the output of a graph. I have some estimates that compare the outcomes of two separate treatment arms to a control group (Treat = group1,group2). The estimates themselves are then saved in separate matrices (matrix A and B), then plotted together for each outcome. Naturally, coefplot accomplishes this task. However, the default is that coefplot will plot each input (matrix) side by side. Is it possible to edit the position of the estimates so that they are stacked/aligned/on the same x-coordinate rather than side by side? Ideally, one of the group of estimates would be shifted to the left (to align with the value marker) and the other would be shifted to the right (to do the same).
Below, I have generated some code similar to my own using some sysuse data. The resulting figure is below as well.
I'm stumped here, so hopefully, someone has some good idea!
Code:
clear all
cap ssc install coefplot
sysuse xtline1
tsset person day
tab person
gen month = month(day)
gen rl_time = month - 6
tab rl
gen treat = 0
replace treat = 1 if person == 1
replace treat = 2 if person == 2
tab treat
forvalues t= -5/-2{
local abs = abs(`t')
gen rl_m`abs' = rl_time == `t'
}
forvalues t =0/6{
gen rl_p`t' = rl_time == `t'
}
reg calories i.treat##(rl_m* rl_p*)
forvalues t=-5/-2{
local abs = abs(`t')
local b1 = _b[1.treat#1.rl_m`abs']
local b2 = _b[2.treat#1.rl_m`abs']
cap matrix A = A, `b1'
if _rc !=0{
matrix A = `b1'
}
cap matrix B = B, `b2'
if _rc !=0{
matrix B = `b2'
}
}
coefplot matrix(A) matrix(B), vert

Comment