r - 集群自举标准错误在 R 中用于 plm 函数
问题描述
我有一个固定效应模型,只有很少的观察结果,因此想要引导以获得更准确的标准误差。同时,我假设 SE 是集群的,因此我也想纠正集群,即进行集群引导。我找到了 lm 模型 ( vcovBS
) 的函数,但是找不到 plm 模型的任何内容。有人知道为固定效应模型获得集群自举 SE 的类似函数吗?
解决方案
clusterSEs 包具有用于 plm 模型的野生集群引导程序的实现:https ://www.rdocumentation.org/packages/clusterSEs/versions/2.6.2/topics/cluster.wild.plml 。
另一种包是fwildclusterboot
. 它不能plm
与其他两个固定效果回归包一起使用,lfe
并且fixest
, 并且应该比clusterSEs
.
使用该fixest
包,其语法如下所示:
library(fixest)
library(fwildclusterboot)
# load data set voters included in fwildclusterboot
data(voters)
# estimate the regression model via feols
feols_fit <- feols(proposition_vote ~ treatment + ideology1 + log_income + Q1_immigration , data = voters)
# bootstrap inference
boot_feols <- boottest(feols_fit, clustid = "group_id1", param = "treatment", B = 9999)
summary(boot_feols)
#> boottest.fixest(object = lm_fit, clustid = "group_id1", param = "treatment",
#> B = 9999)
#>
#> Observations: 300
#> Bootstr. Iter: 9999
#> Bootstr. Type: rademacher
#> Clustering: 1-way
#> Confidence Sets: 95%
#> Number of Clusters: 40
#>
#> term estimate statistic p.value conf.low conf.high
#> 1 treatment 0.073 3.786 0.001 0.033 0.114
推荐阅读
- laravel-5 - Laravel 在数据库查询中合并计数
- python - dockerfile 安装 mysql 并在 ubuntu 镜像中运行脚本
- javascript - 在为 gRPC 流在服务器端调用 .end() 之前,如何在客户端接收数据
- c# - c# WPF 如何在加载 xaml 窗口时显示我的进度条?
- vue.js - 如何在 vuetify 中使用多个日期选择器模式?
- iis - IIS Web API 连接被重置
- image - Xamarin 表单:ImageLoaderSourceHandler:无法检索图像或图像数据无效:
- java - 我的代码没有错误但给我异常缺少返回语句?
- c# - 在 ASP.NET Core 3.0 Swagger 中将字符串标记为不可为空
- vue.js - 尝试导入库时出现 Vue.js 错误