专栏名称: 计量经济学服务中心
见证计量经济学发展,更懂计量更懂你!
目录
相关文章推荐
FM93交通之声  ·  就在明天16时7分!浙江正式进入... ·  2 天前  
杭州日报  ·  确诊127905例!官方公告:这些人必须申报 ·  2 天前  
51好读  ›  专栏  ›  计量经济学服务中心

Stata:面板交互固定效应模型

计量经济学服务中心  · 公众号  ·  · 2024-06-03 23:35

正文

Stata:面板交互固定效应模型

简介

面板交互固定效应模型指的是通过设置个体固定效应与时间效应的交互项,通过控制这些随时间和个体变化的不可观测因素(遗漏变量问题),来减少模型估计的内生性问题,提高模型估计的拟合优度。

白聚山(Bai2009)在线性面板数据中引入了个体差异和时间差异的交互效应,来反映共同因素对不同个体的效应差异。详见 Bai, Jushan. Panel data models with interactive fixed effects. (2009) Econometrica.

面板交互固定效应估计方法

面板交互固定效应模型的估计命令为regife。regife符合Bai(2009)的一个具有交互固定效应的模型。如果希望拟合具有多维/高维固定效果的模型,请使用reghdfe。它还可以保存估计的交互固定效果。该程序需要安装reghdfe和hdfe(在SSC上都可用)。

首先需要下载该外部命令,使用如下命令进行下载

help regife 

regife 现在可以从 ssc下载,但是需要reghdfe

ssc install reghdfe
ssc install regife

在Github上安装最新版本

  • Stata13 +
net install regife, from("https://raw.githubusercontent.com/matthieugomez/regife/master/")

对于Stata 12或更早版本,下载存储库的zip文件,并在Stata中运行以下命令

 net install regife, from("SomeFolderRegife")

引用方法为:

Matthieu Gomez, 2015. REGIFE: Stata module to estimate linear models with interactive fixed effect. Statistical Software Components s457874, Boston College Department of Economics. https://ideas.repec.org/c/boc/bocode/s458042.html

相关语法格式为

regife depvar [indepvars] [if] [in] [weight] , ife(idvar timevar, ndmis) [options]

选项含义为

  • ife (idvar timevar, ndims)指定id变量、时间变量和固定效应的时间维度。要保存估计的交互固定效果,写入ife(ife_idvar = idvar ife_timevar= timevar, ndims).

  • absorb(absvar[...]) 表示将被吸收的固定效应,即加入个体或者时间固定效应

  • vce(vcetype[, opt])   vcetype是unadjusted/ols (default), robust, bootrap or cluster clustervars.。蒙特卡罗证据表明,bootstrap在有限样本中具有较好的性能

  • residuals(newvar)表示保存的残差


案例应用

1、下面我们下载nlswork数据来研究工作年限对员工收入的影响。

webuse nlswork
keep if id <= 100

2、然后进行一维交互固定效应模型估计

* Factor model in id, year of dimension 1
regife ln_w tenure, ife(id year, 1)

3、加入个体效应Model including id fixed effect, and a factor model in id, year of dimension 2

regife ln_w tenure, a(id) ife(id year, 1)

4、个体效应基础上继续加入时间效应Model including id fixed effect, year fixed effect, and a factor model in id, year of dimension 1

regife ln_w tenure, a(id year) ife(id year, 1)

5、保存结果Save interactive fixed effects

regife ln_w tenure, ife(ife_id = id ife_year = year, 1)

6、Save fixed effects and interactive fixed effects

regife ln_w tenure, a(fe_id = id fe_year = year) ife(ife_id = id ife_year = year, 1)

7、产生残差项Generate residuals

regife ln_w tenure, ife(id year, 1) residuals(newvar)






请到「今天看啥」查看全文