【问题标题】:Cluster bootstrapped standard errors in R for plm functions集群自举标准错误在 R 中用于 plm 函数
【发布时间】:2021-06-27 09:00:46
【问题描述】:

我有一个固定效应模型,只有很少的观察值,因此我想通过引导来获得更准确的标准误差。同时,我假设 SE 是集群的,因此我也想纠正集群,即进行集群引导。 我找到了 lm 模型的函数 (vcovBS),但是找不到 plm 模型的任何东西。有没有人知道一个类似的函数来获得固定效应模型的集群自举 SE?

【问题讨论】:

    标签: r cluster-analysis statistics-bootstrap plm


    【解决方案1】:

    clusterSEs 包有一个用于 plm 模型的野生集群引导程序的实现:https://www.rdocumentation.org/packages/clusterSEs/versions/2.6.2/topics/cluster.wild.plml

    另一个包是fwildclusterboot。它不适用于plm,但与另外两个固定效果回归包lfefixest 一起使用,应该比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
    

    【讨论】:

    • 感谢您的快速回复。不幸的是 boottest 不计算标准错误。这里有人知道计算自举 SE 的函数吗?
    猜你喜欢
    • 1970-01-01
    • 2022-12-04
    • 2020-12-22
    • 1970-01-01
    • 2016-01-14
    • 1970-01-01
    • 2013-06-12
    • 2017-10-17
    • 2016-07-22
    相关资源
    最近更新 更多