I am trying to run a difference in difference regression on a stacked data set. The stacking refers to the fact that a treatment company is always paired with a control company. These pairs are then stacked vertically. The data takes the following general specification as seen in the picture.
In total there are 50 pairs. There are also other control variables next to the outcome.
The regression specification I aim to run is the following:
Here T indicates that unit s is treated in pair d, and P indicates that period t is post treatment in in pair d. What this achieves is that time and unit fixed effects are also combined with a pair identifier.
I am unsure how to set this up correctly in Stata with reghdfe or in R, or how to specify the multilevel fixed effects the interaction term here.
I've tried using reghdfe in Stata by including an interaction between my pair ID and unit identifiers in the fixed effects, as well as interacting pair ID with the date, but seem to face problems with the output.
Any help would be greatly appreciated.
