I am trying to replicate a study based on a panel data set (125 countries, 35 years) and I am not able to fully understand the use of the command xi in this particular context. I understand that xi expands terms containing categorial variables into indicator variables.
In the code below Step 2 is clear to me. What is the function of Step 1 though? That means, why is an ivreg2 necessary in advance to expand the variables risocode, year*wb_region into indicator variables?
In the code below Step 2 is clear to me. What is the function of Step 1 though? That means, why is an ivreg2 necessary in advance to expand the variables risocode, year*wb_region into indicator variables?
Code:
* Step 1 /* Generating in-sample indicator so that all specifications have the same number of observations */ qui: xi: ivreg2 intra_state (wheat_aid=instrument) `baseline_controls' i.risocode i.year*i.wb_region if year>=1971 & year<=2006, cluster(risocode) gen in_sample=1 if e(sample)==1 *Step2 *** Panel A: OLS Estimates *** * Col 1 xi: reg any_war wheat_aid i.risocode i.year*i.wb_region if in_sample==1, cluster(risocode) outreg2 wheat_aid using "T2_PanelA_ols.xls", replace se noast nocons lab dec(5)
Comment