处理feols模型似乎是作者正在实现的一项新功能(不在CRAN"v0.1.4"版本中).我try 安装"开发版本",但在运行您的示例时遇到了错误,所以我Forking 了github repo并进行了小更改(您可以在https://github.com/jpmam1/sensemakr处看到更改).如果您安装此版本,该软件包似乎可以按照预期/预期处理feols模型:
# install.packages("fixest")
library(fixest)
devtools::install_github("jpmam1/sensemakr")
#> Downloading GitHub repo jpmam1/sensemakr@HEAD
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file ‘/private/var/folders/gf/3p_ynkts411bs238rtw3y0b40000gn/T/RtmpsM5Zl2/remotes53d5525b31/jpmam1-sensemakr-47f9fe5/DESCRIPTION’ ... OK
#> * preparing ‘sensemakr’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘sensemakr_0.1.5.tar.gz’
library(sensemakr)
#> See details in:
#> Carlos Cinelli and Chad Hazlett (2020). Making Sense of Sensitivity: Extending Omitted Variable Bias. Journal of the Royal Statistical Society, Series B (Statistical Methodology).
model1 <- lm(data = mtcars, mpg ~ vs + cyl + qsec + factor(hp))
model2 <- feols(data = mtcars, fml = mpg ~ vs + cyl + qsec | hp)
sensemakr(model = model1,
treatment = "vs",
benchmark = "cyl",
kd = 0.5)
#> Sensitivity Analysis to Unobserved Confounding
#>
#> Model Formula: mpg ~ vs + cyl + qsec + factor(hp)
#>
#> Null hypothesis: q = 1 and reduce = TRUE
#>
#> Unadjusted Estimates of ' vs ':
#> Coef. estimate: -1.86687
#> Standard Error: 4.7876
#> t-value: -0.38994
#>
#> Sensitivity Statistics:
#> Partial R2 of treatment with outcome: 0.02126
#> Robustness Value, q = 1 : 0.13692
#> Robustness Value, q = 1 alpha = 0.05 : 0
#>
#> For more information, check summary.
sensemakr(model = model2,
treatment = "vs",
benchmark = "cyl",
kd = 0.5)
#> Note for fixest: using 'iid' standard errors. Support for robust standard errors coming soon.
#> Sensitivity Analysis to Unobserved Confounding
#>
#> Model Formula: mpg ~ vs + cyl + qsec | hp
#>
#> Null hypothesis: q = 1 and reduce = TRUE
#>
#> Unadjusted Estimates of ' vs ':
#> Coef. estimate: -1.86687
#> Standard Error: 4.7876
#> t-value: -0.38994
#>
#> Sensitivity Statistics:
#> Partial R2 of treatment with outcome: 0.02126
#> Robustness Value, q = 1 : 0.13692
#> Robustness Value, q = 1 alpha = 0.05 : 0
#>
#> For more information, check summary.
创建于2024年4月22日,共有reprex v2.1.0个
注释"对稳健标准错误的支持即将推出."表明作者仍在努力解决这一问题;大概对feols模型的支持将包含在下一个CRAN版本中.