我从stcrprep
帮助文件中的信息中找到了解决方案,并在命令的作者(http://repec.org/usug2013/lambert.uk13.pdf)的演示中进行了说明。
聚集的标准错误可以很容易地实现如下。
- 使用
stcrprep
准备生存分析数据。
- 使用
stset
创建正确的格式,将权重指定为pweights。将它们指定为iweights会使得鲁棒和群集健壮标准错误的估计不可能。
- 使用
stcox
进行竞争风险回归并指定期望的,vce()
选项。请注意,通过这种数据准备方式,这将产生与stcrreg
完全相同的结果。
对于有兴趣的读者,在竞争性心血管疾病和死亡的其他原因,与审查意见的存在估计的患癌症的风险的一个例子,和患者在治疗中聚簇:
use "http://www.stata-journal.com/software/sj4-2/st0059/prostatecancer", clear
stset time, failure(status=1,2,3) id(id) //specify all possible events
stcrprep, events(status) keep(treatment age therapy) trans(1) //trans creates failcode (event of interest)
gen event = failcode == status
stset tstop [pw=weight_c], failure(event==1) enter(tstart)
stcox treatment age, vce(cluster therapy)