Consider the code
In all three cases, I estimate difference in differences, one via xtreg, the next via xtdidregress and the other using a manual demeaning approach, using robust SEs each time. Only the first two match with one another. The ATTs are identical, but the standard errors are not. Why?
Code:
clear *
u "https://github.com/jgreathouse9/FDIDTutorial/raw/main/basque.dta", clear
cls
xtreg gdpcap i.treat i.year, fe vce(r)
xtdidregress (gdpcap) (treat), group(id) time(year) vce(r)
qui {
keep id year gdpcap
qui reshape wide gdpcap, j(id) i(year)
order gdpcap5, a(year)
egen ymean = rowmean(gdpcap1-gdpcap17)
drop gdpcap1-gdpcap17
}
g ydiff = gdpcap5-ymean
qui reg ydiff if year < 1975
loc alpha = e(b)[1,1]
g cf = ymean + `alpha'
g post = cond(year>=1975,1,0)
reg ydiff post, vce(r)

Comment