I am using the coefplot
package in Stata to plot how a coefficient changes depending on the model employed. In particular, I want to see how the coefficient of interest changes over time. I am plotting it vertically, so the x-axis could show the year to which each coefficient refers to. However, I am not able to label the x-axis accordingly (instead of showing the name of the variable I am interested, x1
, it should state 1, 2 and 3. I would also like to omit the legend by using the option legend(off)
but that does not work.
This is the code I am using:
reg y x1 x2 if year==1;
estimates store t1;
reg y x1 x2 if year==2;
estimates store t2;
reg y x1 x2 if year==3;
estimates store t3;
coefplot t1 t2 t3, drop(x2) vertical yline(0);
Any suggestion would be greatly appreciated.
if
in yourregress
commands; they could not possibly work otherwise. – Portuna