A direct formula calculates a difference-in-differences treatment effect by subtracting the control group’s change from the treated group’s change. Applied to observed group-time averages, it estimates the ATET directly. section 11.4.5
Apply the method in three steps:
- Compute the treated group’s post-treatment mean minus its pre-treatment mean. section 11.4.5
- Compute the corresponding change for the untreated control group. section 11.4.5
- Subtract the control change from the treated change to obtain the estimated effect. section 11.4.5
Estimating uncertainty
Bootstrap confidence intervals by resampling with replacement, recalculating the ATET many times—typically 1,000 to 10,000—and taking the 2.5th and 97.5th percentiles for a 95% interval. section 11.4.5
Listing 11.22 (R) DiD ATE estimation with the direct method
diff_1 <- mean(df_observed[ df_observed$time_points == 1 & df_observed$D == 1, 'Y' ]) - mean(df_observed[ df_observed$time_points == 0 & df_observed$D == 1, 'Y' ]) diff_0 <- mean(df_observed[ df_observed$time_points == 1 & df_observed$D == 0, 'Y' ]) -mean(df_observed[ df_observed$time_points == 0 & df_observed$D == 0, 'Y' ]) diff_1 - diff_0
R implements the direct estimator by calculating within-group changes and subtracting them. section 11.4.5
