适用于截断数据的tobit模型,用censReg包和AER包都可以实现。
library(censReg)
library(AER)
t1 <- censReg(donate.soc ~ resivalue.log + otherhousevalue.log
+ f.asset.log + otherasset.log
+ debts.log
+ inc.f.log + inc.log
+ fml.count + male + age + edu.cont + emp +egp + tizhi + marry,
data=df.urban)
t2 <- AER::tobit(donate.soc ~ resivalue.log + otherhousevalue.log
+ f.asset.log + otherasset.log
+ debts.log
+ inc.f.log + inc.log
+ fml.count + male + age + edu.cont + emp +egp + tizhi + marry,
data=df.urban)
summary(t1)
summary(t2)
通过比较可以发现两个命令的结果都相同。
比较:
censReg:兼容stargazer,不兼容mediation,运行速度慢。
AER:不兼容stargazer,兼容mediation,运行速度快。
AER::tobit原本是兼容stargazer的,但随着版本更新出现了bug。
Using
stargazer
v5.2.2 andAER
v1.2-9 it works only if you drop theAER::
in front of tobit, which is strange. Maybe you should write a bug-report, although I'd strongly recommend usingtexreg
instead ofstargazer
.引用来源:r - Stargazer does not recognise tobit even though it is supported - Stack Overflow