我正在尝试使用“钴”包来评估倾向得分加权后的协变量平衡,但我的问题是那些没有得到治疗的人的权重为 0(这是我们设计它的方式,我们无法改变它应该是这样的),所以当我想使用它时它说:
Error: All weights are zero when treat is 0.
当我对那些“治疗”=1 的人进行“治疗”子集时,它说:
Error: The argument to 'treat' must be a vector of treatment statuses or the (quoted) name of a variable in 'data' that contains treatment statuses.
有没有人遇到过这种情况?修复此错误的任何提示或技巧?
Treat<- c(1,1,1,1,1,0,0,0,0,0,0,0)
Weights<- c(0.2, 0.3,0.5,1.2, 0.9, 0,0,0,0,0,0,0)
X1<- c(1,0,1,0,1,0,1,0,1,1,1,1)
X2<- c(2001, 2000, 1992, 1998, 2002, 2016, 2018, 2019, 2011, 2000, 2012, 2014)
X3<- c(1,1,1,1,0,0,0,0,1,0,1,0)
data<- data.frame(Treat, X1, X2, X3)