如何解决如何对 CEM 匹配数据运行 ttest?
我已经使用 Stata 对我的数据运行了 CEM 匹配过程,现在我想知道如何对匹配数据的变量运行 t 检验。
/* Simple example of my code; first I run the CEM */
cem age gender education,treatment(treat)
/* Then I want to have a look at the summary statistics of the entire population and the matched data (this code works fine) */
summarize age gender education
summarize age gender education [iweight=cem_weights]
/* But if I want to do a t test only on the matched data,I get an error with the weights */
ttest age,by(treat) /* works fine */
ttest age [iweight=cem_weights],by(treat) /* error saying that weights are not allowed */
如何仅对匹配的数据运行 t 测试?一个选项也可以是导出匹配的数据,那么我该怎么做?
解决方法
应该这样做:
sysuse auto,clear
cem mpg weight rep78,treatment(foreign)
mean price [iweight = cem_weight],over(foreign) //coeflegend
lincom _b[c.price@1.foreign] - _b[c.price@0.foreign]
就我个人而言,我只会使用具有 het-robust 标准误差的回归(这里得到类似的结果,并且在更大的样本下会更接近):
regress price i.foreign [iweight = cem_weight],robust
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。