Post-treatment confounding is a common problem in causal inference, including special cases of noncompliance, truncation by death, surrogate endpoint, etc. Principal stratification (Frangakis and Rubin 2002) is a general framework for defining and estimating causal effects in the presence of post-treatment confounding. A prominent special case is the instrumental variable approach to noncompliance in randomized experiments (Angrist, Imbens, and Rubin 1996). Despite its versatility, principal stratification is not accessible to the vast majority of applied researchers because its inherent latent mixture structure requires complex inference tools and highly customized programming. We develop the R package PStrata to automatize statistical analysis of principal stratification for several common scenarios. PStrata supports both Bayesian and frequentist paradigms. For the Bayesian paradigm, the computing architecture combines R, C++, Stan, where R provides user-interface, Stan automatizes posterior sampling, and C++ bridges the two by automatically generating Stan code. For the Frequentist paradigm, PStrata implements a triply-robust weighting estimator. PStrata accommodates regular outcomes and time-to-event outcomes with both unstructured and clustered data.
翻译:治疗后混杂是因果推断中的常见问题,包括不依从、死亡截断、替代终点等特殊情况。主分层(Frangakis and Rubin 2002)是在治疗后混杂存在时定义和估计因果效应的通用框架。其重要特例是随机实验中针对不依从问题的工具变量方法(Angrist, Imbens, and Rubin 1996)。尽管主分层方法应用广泛,但其固有的潜混合结构需要复杂的推断工具和高度定制化编程,导致大多数应用研究者难以掌握。我们开发了R语言包PStrata,用于自动化分析几种常见场景下的主分层统计。PStrata同时支持贝叶斯和频率学派范式。在贝叶斯范式中,计算架构结合了R、C++和Stan:R提供用户界面,Stan自动进行后验采样,C++通过自动生成Stan代码在两者间建立桥梁。在频率学派范式中,PStrata实现了三重稳健加权估计量。PStrata可处理非结构化和聚类数据中的常规结局及时间至事件结局。