简短的回答是,在单位或治疗组级别使用固定效应不会改变估计,只会改变推断。通常,使用单位固定效应会吸收更多的变化,因此您的标准误差会更小。
单位是否在同一个聚合组中不会改变这个结果(它只会改变您定义处理组级别的方式,以及您需要面板而不是重复横截面的事实)。这同样适用于时间固定效应:您可以使用年份固定效应,也可以只使用 FE 来表示前后。
但是请注意,仅当没有协变量 X 时,等价性才成立。一旦有了 X,无论您使用单位固定效应还是组固定效应,结果都会有所不同。
下面的示例比较了 5 个估计量。估计器是:
- OLS
- FE 与 FE:(治疗)组(治疗)期
- FE 与 FE:按(治疗)期划分的单位
- FE 与 FE:(治疗)按年分组
- FE 与 FE:按年计算的单位
OLS FE period-group FE period-unit FE year-group FE year-unit
---------------------------------------------------------------------------------------------
did -0.4028 * -0.4028 * -0.4028 * -0.4028 * -0.4028 *
(0.1853) (0.1853) (0.1834) (0.1758) (0.1727)
---------------------------------------------------------------------------------------------
Num. obs. 70 70 70 70 70
Num. groups: time 2 2
Num. groups: treated 2 2
Num. groups: country 7 7
Num. groups: year 10 10
=============================================================================================
*** p < 0.001; ** p < 0.01; * p < 0.05
下表显示了前 3 个回归,这次是协变量:
===================================================================
OLS x FE period-group X FE period-unit X
-------------------------------------------------------------------
did -0.407 * -0.407 * -0.460 *
(0.189) (0.189) (0.187)
x1 0.018 0.018 0.220
(0.104) (0.104) (0.165)
-------------------------------------------------------------------
Num. obs. 70 70 70
Num. groups: time 2 2
Num. groups: treated 2
Num. groups: country 7
===================================================================
*** p < 0.001; ** p < 0.01; * p < 0.05
代码:
library(tidyverse)
library(haven)
library(texreg)
library(lfe)
dat <- read_dta("http://dss.princeton.edu/training/Panel101.dta") %>%
mutate(time = (year>=1994) ,
treated = (country>4),
did = time*treated)
reg_ols <- lm(y_bin~ time+ treated+ did, data = dat)
reg_fe_a <- felm(y_bin~ did | time+ treated, data = dat)
reg_fe_b <- felm(y_bin~ did | time+ country, data = dat)
reg_fe_c <- felm(y_bin~ did | year+ treated, data = dat)
reg_fe_d <- felm(y_bin~ did | year+ country, data = dat)
reg_ols_x <- update(reg_ols, .~.+x1)
reg_fe_a_x <- update(reg_fe_a, .~.+x1)
reg_fe_b_x <- update(reg_fe_b, .~.+x1)
screenreg(list(reg_ols, reg_fe_a, reg_fe_b, reg_fe_c, reg_fe_d),
omit.coef = "time|treated|Intercept", digits=4,
include.rsquared = FALSE, include.adjrs = FALSE, include.rmse = FALSE,
custom.model.names = c("OLS", "FE period-group", "FE period-unit", "FE year-group", "FE year-unit"))
#>
#> =============================================================================================
#> OLS FE period-group FE period-unit FE year-group FE year-unit
#> ---------------------------------------------------------------------------------------------
#> did -0.4028 * -0.4028 * -0.4028 * -0.4028 * -0.4028 *
#> (0.1853) (0.1853) (0.1834) (0.1758) (0.1727)
#> ---------------------------------------------------------------------------------------------
#> Num. obs. 70 70 70 70 70
#> Num. groups: time 2 2
#> Num. groups: treated 2 2
#> Num. groups: country 7 7
#> Num. groups: year 10 10
#> =============================================================================================
#> *** p < 0.001; ** p < 0.01; * p < 0.05
screenreg(list(reg_ols_x, reg_fe_a_x, reg_fe_b_x),
omit.coef = "time|treated|Inter", digits=3,
include.rsquared = FALSE, include.adjrs = FALSE, include.rmse = FALSE,
custom.model.names = c("OLS x", "FE period-group X", "FE period-unit X"))
#>
#> ===================================================================
#> OLS x FE period-group X FE period-unit X
#> -------------------------------------------------------------------
#> did -0.407 * -0.407 * -0.460 *
#> (0.189) (0.189) (0.187)
#> x1 0.018 0.018 0.220
#> (0.104) (0.104) (0.165)
#> -------------------------------------------------------------------
#> Num. obs. 70 70 70
#> Num. groups: time 2 2
#> Num. groups: treated 2
#> Num. groups: country 7
#> ===================================================================
#> *** p < 0.001; ** p < 0.01; * p < 0.05
由reprex 包于 2021-04-01 创建(v1.0.0)