# Difference-in-difference in panel data

Under which conditions should we expect the difference-in-difference estimate to be equal to the equivalent panel data model?

Strictly speaking, whenever we have a experiment that offers a well defined treated and control groups in two periods of time, for using difference-in-difference methods, people recommend running OLS of models such as:

Stata:

reg y post treatment postXtreatment

and the coefficient on "postXtreatment" would represent the treatment effect

At the same time, in case we have panel data for two periods we can run:

xi: xtreg y i.year postXtreatment, fe


When exactly should we expect equivalence? Does it have anything to do with the panel being balanced?

Just one more question, in case we have more years available is the fixed effect model in the fashion the described above a good way to infer the treatment effect?

• Should be completely identical with two treatment groups and two time periods. – ilprincipe Sep 26 '13 at 15:10

You would expect equivalence when T = 2. If you have more than 2 years, use the latter approach (the one that relies on fixed effects). Please see http://econ.lse.ac.uk/staff/spischke/ec533/did.pdf for more. Note: xi: is redundant in the newer versions of Stata.