社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

Stata:面板Logit的边际效应和处理效应估计-mfelogit

连享会 • 9 月前 • 181 次点击  

👇 连享会 · 推文导航 | www.lianxh.cn

连享会课程 · 机制分析与政策优化

作者:郭盼亭 (厦门大学)
邮箱:gpting2020@163.com

温馨提示: 文中链接在微信中无法生效。请点击底部「阅读原文」。或直接长按/扫描如下二维码,直达原文:


目录

  • 1. 前言

  • 2. 理论背景

    • 2.1 模型设定

    • 2.2 平均边际效应的识别

    • 2.3 平均处理效应的识别

  • 3. mfelogit 命令

  • 4. 参考资料

  • 5. 相关推文



1. 前言

固定效应模型是面板数据分析的常用模型之一。当因变量为二元离散变量的时候,可以使用固定效应线性概率模型和固定效应 logit 模型 (又称面板 logit 模型)。其中,固定效应 logit 模型允许处理效应的异质性,是解决因变量为二元离散变量的有力模型。

2. 理论背景

2.1 模型设定

Davezies 等人 (DDL,2021) 假设有一个 期的面板数据,结果变量 为二元离散变量 ,协变量 ,并且数据满足如下假设:

  • 假设 1:,其中,独立于 ,并且服从 logistic 分布。
  • 假设 2: 为非奇异。

2.2 平均边际效应的识别

根据定义,平均边际效应可以表示为:

结合假设 1,,从而可以得出:

假如假设 1 和假设 2 成立,我们可以得到如下引理 1:

以及尖锐边界 (sharp bounds)

2.3 平均处理效应的识别

当协变量 为二元变量时,即 ,接受处理的组的平均处理效应可以表示为:

假如假设 1 和假设 2 成立,我们可以得到关于尖锐边界 (sharp bounds) 的引理 2:

对于没有接受处理的组的平均处理效应可以表示为:

从而平均处理效应为:

其估计量可以表示为:

3. mfelogit 命令

mfelogit 实现了 Davezies 等 (DDL,2021) 关于 AME 的尖锐边界估计 (estimators of the sharp bounds on AME) 以及 AME 和 ATE 的相关置信区间估计。另外,mfelogit 还可以实现 DDL (2021) 中提出的第二种方法,该方法计算速度更快,但可能导致更大的置信区间。最后,当解释变量为二元变量时,该命令计算 ATE,否则将计算 AME。

命令安装:

ssc install mfelogit

命令语法:

mfelogit varlist [if] [in] id(string) time(string) 
[, method(string) listT(string) listX(string)
level(string) eps(string) ratio(string)]

其中,varlist 是变量列表,id 指定作为个体标识符的变量,time 指定用作不同时间段标识符的变量。options 主要包含以下内容:

  • method:指定使用的方法。它的参数必须是 sharpquick (默认值)中的一个。参数 sharp 代表 DDL (2021) 中的第一个方法。参数 quick 表示 DDL (2021) 中的第二个方法,此方法更快。注意,对于 ATE 只有第二个方法 quick 可用。

  • listT:指定 AME/ATE 的计算周期,参见 DDL (2021) 中的 5.4 节。它可以取以下值:

    • 如果为空 (默认选项),则在样本中所有个体可观测到的最后一个周期计算 AME/ATE。它在最终的输出表中以 Tinf 为标记。
    • 如果提供了一个从 1 到最大观测周期数的列表,那么对于该列表中的每个值,我们计算所有所选协变量在相应周期的 AME/ATE。在最终的输出表中,列 T 标示相应周期。
    • 如果为 all:这将类似于上述情况,计算所有观察时期的 AME/ATE,以及所有时期的平均值。最后一种情况在最终输出表中由 Average 标记。
  • listX:指定计算 AME/ATE 的所选变量的列表。默认情况下,为所有协变量计算 AME/ATE。

  • level:设置置信区间的值 (默认为 0.95)。

  • eps:指定为第一种方法选择的置信区间类型。eps 为空的情况下,默认使用 DDL (2021) 中定义的 CI2。如果设置为不等于 0 的值,则使用 DDL (2021) 中定义的 CI3。最后,如果设置为 0,则 CI3 和 epsilon = ln(ln(n)) 一起使用。

  • ratioratio 设置 DDL (2021) 中第一种方法的非参数估计中偏差/方差的比值 (the value of the bias/variance ratio) (更多细节请 DDL (2021) 的附录 C),默认值为 10。

. use "https://www.stata-press.com/data/r17/union.dta", clear
. mfelogit union age black if (year <=78), id("idcode") time("year") method("quick")

Estimates of coefficients in the fixed effect logit model (CMLE)
---------------------------------------------------
Point Est. Std. Err. p-value
---------------------------------------------------
age .0254468 .0100241 .011131
---------------------------------------------------
Estimates of the Average Marginal Effects in the fixed effect logit model
---------------------------------------------------
Estimate [95% Conf. Interval]
---------------------------------------------------
age(Tinf) .0022199 .0003422 .0040976
---------------------------------------------------
Notes:
Nb of observed individuals: 3167
Nb of discarded individuals: 828
Maximal number of observed periods: 6
The method used to compute AME/ATE is the quick method (i.e. the second method in DDL).
. mfelogit union age black if (year <=78), id("idcode") time("year") method("quick") listT("all")

Estimates of coefficients in the fixed effect logit model (CMLE)
---------------------------------------------------
Point Est. Std. Err. p-value
---------------------------------------------------
age .0254468 .0100241 .011131
---------------------------------------------------
Estimates of the Average Marginal Effects in the fixed effect logit model
----------------------------------------------------------------
Period Estimate [95% Conf. Interval]
----------------------------------------------------------------
age 1 .0020879 -.00034 .0045158
age 2 .002115 -.0002957 .0045256
age 3 .0018418 -.0001786 .0038622
age 4 .0013656 -.0002081 .0029394
age 5 .000772 -.0001361 .0016801
age 6 .0004178 -.0002116 .0010471
age(Average) . .0020913 .0010468 .0031358
----------------------------------------------------------------
Notes:
Nb of observed individuals: 3167
Nb of discarded individuals: 828
Maximal number of observed periods: 6
The method used to compute AME/ATE is the quick method (i.e. the second method in DDL).

4. 参考资料

Davezies L, D'Haultfoeuille X, Laage L. Identification and estimation of average marginal effects in fixed effects logit models[J]. arXiv preprint arXiv:2105.00879, 2021. -PDF-

5. 相关推文

Note:产生如下推文列表的 Stata 命令为:
lianxh probit logit, m
安装最新版 lianxh 命令:
ssc install lianxh, replace

  • 专题:Stata命令
    • Stata新命令:面板-LogitFE-ProbitFE
  • 专题:交乘项-调节-中介
    • Logit-Probit中的交乘项及边际效应图示
  • 专题:Probit-Logit
    • 全面解读Logit模型
    • Stata:面板混合选择模型-cmxtmixlogit
    • Logit-Probit:非线性模型中交互项的边际效应解读
    • 秒懂小罗肥归:logit与mlogit详解
    • reg2logit:用OLS估计Logit模型参数
    • feologit:固定效应有序Logit模型
    • Stata:多元 Logit 模型详解 (mlogit)
    • Stata:Logit模型一文读懂
    • 详解 Logit/Probit 模型中的 completely determined 问题
    • Stata:Logit 模型评介
    • 二元选择模型:Probit 还是 Logit?
    • Stata:何时使用线性概率模型而非Logit?
    • Stata:嵌套 Logit 模型 (Nested Logit)
    • Stata:二元Probit模型
    • 动态 Probit 模型及 Stata 实现

New! Stata 搜索神器:lianxhsongbl  GIF 动图介绍
搜: 推文、数据分享、期刊论文、重现代码 ……
👉 安装:
. ssc install lianxh
. ssc install songbl
👉  使用:
. lianxh DID 倍分法
. songbl all

🍏 关于我们

  • 连享会 ( www.lianxh.cn,推文列表) 由中山大学连玉君老师团队创办,定期分享实证分析经验。
  • 直通车: 👉【百度一下: 连享会】即可直达连享会主页。亦可进一步添加 「知乎」,「b 站」,「面板数据」,「公开课」 等关键词细化搜索。


Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/159987
 
181 次点击