简短的答案是,在单位或治疗组水平使用固定效应不会改变估计,只能推论。通常,使用单位固定效果将吸收更多的变化,因此标准误差较小。
单位是否在同一聚合组中不会更改此结果(它只会更改您定义已处理组级别的方式,以及需要面板而不是重复横截面的事实)。
但是请注意,等价仅在没有协变量X时成立。一旦有了X,则无论使用单位固定效果还是组固定效果,结果都不同。
下面的示例比较了有和没有X的两种情况下的3个估计量。估计量为:
- 最小二乘
- FE(治疗)组固定效果
- 单元固定效果的有限元
#> OLS FE treated FE unit OLS x FE treated x FE unit x
#> ----------------------------------------------------------------------------------
#> (Intercept) 0.500 *** 0.491 ***
#> (0.094) (0.107)
#> did -0.403 * -0.403 * -0.403 * -0.407 * -0.407 * -0.460 *
#> (0.185) (0.185) (0.183) (0.189) (0.189) (0.187)
#> x1 0.018 0.018 0.220
#> (0.104) (0.104) (0.165)
#> ----------------------------------------------------------------------------------
#> Num. obs. 70 70 70 70 70 70
#> ==================================================================================
#> *** 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_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_ols_x, reg_fe_a_x, reg_fe_b_x),
omit.coef = "time|treated", digits=3,
include.rsquared = FALSE, include.adjrs = FALSE, include.rmse = FALSE,
custom.model.names = c("OLS", "FE treated", "FE unit", "OLS x", "FE treated x", "FE unit x"))