[英]How to extract the actual values of parameters and their standard error instead of the marginal effect estimates in lmer from package lme4 in R?
[英]Calculate marginal effect of dummy (and its standard error) for Tobit in R
我有一个标准的 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 那样工作的函数? 再次感谢。
您可能想尝试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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.