Using 'coefplot', I am unable to plot the same estimate from different models across three years without having the estimates bunch up into a single year's plot region. The steps in my code are in the order below:
- Estimate the slope coefficient with reghdfe and store them.
- Prepare the estimates for 'estab' with 'estfe' and export tables.
- Only plot the estimated coefficient on the independent variable for three dependent variables (dv). Each dv has 4 models. Each model is estimated for 3 years. Total 12 estimated coefficients for each of the 3 outcome (subgraph). The models start with the word: reg(for bivariate); C( with controls); P(bivariate placebo sample); C_P(placebo sample with controls).
- Unexpected graph output (attached): while the 3 subgraphs in the graph indicate the 3 years beside the Y axis but the estimates are bunched up in 1 year's plot region in each of the subgraphs rather than plotted neatly across all 3 years. The label for each individual year are also overlapping with one another.
Code:
***OLS Estimates with Controls (the same is repeated without controls for both sample and placebo sample)*** foreach v of numlist 91 01 11 { if length("`v'") == 1 local v 0`v' foreach m of varlist lg`v'light trd`v' lit`v' { qui reghdfe `m' k_y_n lg`v'p sc`v' st`v' tdist_500 nrcity_km if pc11_pca_tot_p <10000, absorb(state_district) vce(robust) est sto C`m' } } ***Prepare estimates for esttab*** estfe reg* C* P* C_P*, labels(state_district "District_FE") ***Coefplot*** coefplot (reglg*light, label(Bivariate) msymbol(oh)) (Clg*light, label(With Controls) msymbol(o)) (Plg*light, label(Bivariate (Placebo)) msymbol(th)) (C_Plg*light, label(With Controls (Placebo)) msymbol(t)), bylabel(Economic Activity) || (regtrd*, label(Bivariate) msymbol(oh)) (Ctrd*, label(With Controls) msymbol(o)) (Ptrd*, label(Bivariate (Placebo)) msymbol(th)) (C_Ptrd*, label(With Controls (Placebo)) msymbol(t)), bylabel(Road) || (reglit*, label(Bivariate) msymbol(oh)) (Clit*, label(With Controls) msymbol(o)) (Plit*, label(Bivariate (Placebo)) msymbol(th)) (C_Plit*, label(With Controls (Placebo)) msymbol(t)), bylabel(Literacy) ||, groups(*91*="{bf:1991}" *01*="{bf:2001}" *11*="{bf:2011}", labsize(tiny)) keep(k_y_n) xline(0, lcolor(black) lwidth(thin) lpattern(dash)) byopts(xrescale) ylabel(none) ytick(none) asequation swapnames mlabposition(1) mlabel(cond(@pval<.05, "*", "")) note("* p < .05")
Comment