看 wooldridge的初级的书上面有理论:面板数据和混合数据都有介绍。
https://bbs.pinggu.org/thread-1342481-1-1.html
看Principles of Econometrics 也有理论介绍
看去配套Using Stata for Principles of Econometrics, 4e, Lee C. Adkins and R. Carter Hill的chapter 07
http://www.principlesofeconometrics.com/poe4/poe4stata_do.htm
* Chapter 7.5.6 Differences in Differences Estimators
* open data file
use njmin3, clear
describe
summarize nj d d_nj fte
* DID estimation using sample means
bysort nj d: summarize fte
* DID estimation using regression
reg fte nj d d_nj
estimates store did
lincom _cons + nj
lincom _cons + d
lincom _cons + nj + d + d_nj
lincom (_cons + nj + d + d_nj)-(_cons + d)-((_cons + nj)-_cons)
* add owner controls
reg fte nj d d_nj kfc roys wendys co_owned
estimates store did2
* add location controls
reg fte nj d d_nj kfc roys wendys co_owned southj centralj pa1
estimates store did3
esttab did did2 did3, b(%10.4f) se(%10.3f) t(%10.3f) r2 ar2 ///
title("Difference in Difference Regressions")
* DID regression using only balanced sample
reg fte nj d d_nj if !missing(demp)