Event Study Regression (Event Studies)
In this exercise, you’ll build an event study from scratch using panel_gis.dta. The goal is to trace out the dynamic effect of STRV seed adoption on crop yields over time, using the interaction-weighted estimator from Sun and Abraham (2021).
- Generate a cohort variable that records the first year each district received STRV seed. Create a temporary variable equal to
yearwhenseed > 0, then usebysortandegen min()to createfirst_seedthat pushes the earliest adoption year to all observations within each district. Drop the temporary variable. - Create a relative time variable
ryequal toyearminus the cohort variable. Bin any values greater than 10 to 10 by makingry = 10whenry > 10and also not missing (remember, Stata treats.as infinitely large). - Identify the control cohort. Generate an indicator for districts that never received seed (
never_seed) and a separate indicator for districts that received seed last (in 2019) (last_seed). - Generate lead dummies using a
forvaluesloop counting down from 16 to 2. Name themg_k(e.g.,g_16,g_15, …,g_2), where each equals 1 whenry == -k. Inside the loop, uselabel var g_k "-k"so the variable has a clean name for tables. - Generate lag dummies using a
forvaluesloop from 0 to 10. Name themgk(e.g.,g0,g1, …,g10), where each equals 1 whenry == k. Inside the loop, uselabel var gk "k"so it has a clean name for tables.
1. Run the regression using xtreg, specifying evi_med as the outcome, include all lead and lag dummies (g_* g0-g10), add year fixed effects (i.year), specify the fe option to absorb district fixed effects, and cluster standard errors at the district_id level. Store the event study results by prefixing the regression with eststo twfe:.
Now run the robust event study using eventstudyinteract. Specify evi_med as the outcome, include all lead and lag dummies (g_* g0-g10), set the cohort variable with cohort(first_seed), identify the control cohort with control_cohort(last_seed), include fld_cuml as a covariate with covariates(), absorb district and year fixed effects with absorb(i.district_id i.year), and cluster standard errors at the district_id level.
Because eventstudyinteract stores its estimates internally in e(b_iw) instead of e(b), commands like esttab won’t find them by default. Before exporting, you must move the results using erepost and store them:
* post results for esttab
matrix b_iw = e(b_iw)
matrix V_iw = e(V_iw)
erepost b = b_iw V = V_iw
eststo iw
Export both stored results to a single LaTeX table using the code block below. Adjust \scalebox{} to make the table fit in your document.
* export results to latex
esttab twfe iw using "$answ/12-event-reg.tex", replace ///
b(4) se(4) ///
drop(*.year _cons) ///
star(* 0.10 ** 0.05 *** 0.01) ///
mtitles("TWFE" "Interaction-Weighted") ///
noobs booktabs nonum ///
eqlabels(none) collabels(none) ///
nobaselevels nogaps fragment label ///
prehead("\begin{tabular}{l*{2}{c}} " ///
"\\[-1.8ex]\hline \hline \\[-1.8ex] " ///
"& \multicolumn{2}{c}{Event Study} \\ \midrule") ///
postfoot("\hline \hline \\[-1.8ex] " ///
"\multicolumn{3}{p{\linewidth}}{\small " ///
"\noindent \textit{Note}: Dependent variable " ///
"is median EVI. Standard errors clustered at the " ///
"district level (in parentheses). " ///
"* p$<$0.10, ** p$<$0.05, *** p$<$0.01.} " ///
"\end{tabular}")
2. Looking at the two columns, do you see evidence of bias in the TWFE pre-trend coefficients (the negative lags) compared to the interaction-weighted estimator?