I am estimating the coefficient of an interaction term for multiple samples. These samples are observations from different ranges of a variable measuring a distance (i.e. 5km, 10km, and so on until 50km).
I am using coefplot to plot the coefficient estimate for the interaction (dummy*dummy) along with the confidence intervals.
I want the x axis to display the different values of the distance rather than the interaction. In red in the attached image.
Here is my code:
HTML Code:
local bandwidth 5 10 15 20 25 30 35 40 45 50 foreach outcome in "outcome1" "outcome2" "outcome3"{ foreach x of local bandwidth { display "`x'" regress `outcome' i.dum1##i.dum2 if inrange(distance,-`x',`x') /* */, vce(cluster `cluster') est store disd_`x'_`outcome' } coefplot (disd_5_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_10_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_15_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_20_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_25_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_30_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_35_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_40_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_45_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ (disd_50_`outcome', keep(1.dum1#1.dum2) mcolor(navy) levels(99 95 90)) /* */ , yline(0) graphregion(color(white)) bgcolor(white) legend(off) label vertical /* yscale(range(-0.1 0.1)) ymtick(-0.1(0.05)0.1) }
0 Response to Coefplot interaction term - loop multiple sample, label x axis
Post a Comment