Plotting robustanalyses based on changes in definition of explanatory variable

The following might be of use when you want to plot robustanalyses based on changes in definition of explanatory variables. I give an example: I analyze the effect of firms’ share of part-time employment on firm productivity. I define part-time as working less than 24 hours per week as this is common in the sector I analyse. However, to check the robustness of my results, I plot a figure in which I report the coefficients of the variable measuring firms’ share of part-time employment (and firms’ share of full-time employment) with confidence intervals. Hereby, I can show whether the coefficient (and its standard error changes a lot when using other definitions of part-time employment) and at the same time whether this coefficient is significantly different from the coefficient on firms’ share of full-time employment.

Do file:

set more off
gen b1=.
gen b2=.
gen nr=_n

gen c1up=.
gen c1down=.
gen c2up=.
gen c2down=.

forvalues i = 5/33 {
xi: reg lprod ptshare`i’ ftshare`i’ /*
 */ x3-x12 /*

replace b1 = _b[ptshare`i’] if `i’==nr
replace b2 = _b[ftshare`i’] if `i’==nr

replace c1up   =  _b[ptshare`i’] + _se[ptshare`i’]*1.96 if `i’==nr
replace c1down =  _b[ptshare`i’] – _se[ptshare`i’]*1.96 if `i’==nr

replace c2up   = _b[ftshare`i’] + _se[ftshare`i’]*1.96  if `i’==nr
replace c2down = _b[ftshare`i’] – _se[ftshare`i’]*1.96  if `i’==nr

}

label variable b1 “Coefficient of pt”
label variable b2 “Coefficient of ft”
label variable c1up “Upper bound of confidence interval pt”
label variable c2up “Upper bound of confidence interval ft”
label variable c1down “Lower bound of confidence interval pt”
label variable c2down “Lower bound of confidence interval ft”
label variable nr “Definition of part-time employment”

capture twoway (line b1 nr, lpattern(solid) lc(black) ) /*
 */ (line c1up nr, lpattern(dot) lc(black)) (line c1down nr, lpattern(dot) lc(black))  /*  
 */ (line b2 nr, lpattern(solid) lc(gs10))  /*
 */ (line c2up nr, lpattern(dash_dot) lc(gs10)) (line c2down nr, lpattern(dash_dot) lc(gs10))  /*  
 */ if nr>=16 & nr<=36, legend(col(1)) legend(region(fcolor(white))) /*
 */ graphregion(fcolor(white)lcolor(white)icolor(white)ilstyle(none)) /*
 */ ylabel(,angle(0)) ytitle(“Regression Coefficients”) /* 
 */ xlabel(16 20 24 28 32)

graph2tex, epsfile(robust1)
pwd

Leave a Reply