1

我有一个标准的 Tobit 模型,其中唯一的解释变量是治疗的虚拟变量(加上截距),我想估计这种治疗对我的因变量的边际效应以及这个 ME 的标准误差。

我知道 R 中的 mfx 包能够恢复我想要的 Probit 和 Logit 模型,但我找不到 Tobit 的类似包。有谁知道可以做到这一点的软件包或如何通过“手动”恢复 ME 及其标准错误?谢谢!

编辑:AER 包有一个估计 Tobit 模型的函数,所以我一直在寻找使用它计算 ME(和 ME 的标准误差)的某种方法。这是我使用 AER 包中的数据所做的示例。

library(AER)

data("CollegeDistance")

model <- tobit(CollegeDistance$education ~ CollegeDistance$gender, left = 0, data = CollegeDistance, x= TRUE)

使用此代码,我可以恢复截距和虚拟变量(性别)的 Tobit 系数、比例参数以及“性别”和截距的平均值。但与 Probit/Logit 的 mfx 包不同,AER 包中的 Tobit 函数不会返回性别对教育年限的边际影响,也不会返回其标准误差。

所以,我想知道 1) 是否有人知道如何从 AER 的 tobit 函数的输出中恢复 ME 和 ME 的标准错误,或者 2) 是否有人知道 probitmfx 为 Probit 工作的函数?再次感谢。

4

1 回答 1

0

你可能想试试这个marginaleffects 包。 (免责声明:我是维护者。)

library(AER)
library(marginaleffects)
data("CollegeDistance")
model <- tobit(education ~ gender, left = 0, data = CollegeDistance, x= TRUE)
mfx <- marginaleffects(model)
summary(mfx)
## Average marginal effects 
##       type         Term  Effect Std. Error z value Pr(>|z|)   2.5 %  97.5 %
## 1 response genderfemale -0.0351    0.05222 -0.6722  0.50148 -0.1374 0.06725
## 
## Model type:  tobit 
## Prediction type:  response
于 2021-11-22T02:01:01.500 回答