Quantifying the causal effects of continuous exposures on outcomes of interest is critical for social, economic, health, and medical research. However, most existing software packages focus on binary exposures. We develop the CausalGPS R package that implements a collection of algorithms to provide algorithmic solutions for causal inference with continuous exposures. CausalGPS implements a causal inference workflow, with algorithms based on generalized propensity scores (GPS) as the core, extending propensity scores (the probability of a unit being exposed given pre-exposure covariates) from binary to continuous exposures. As the first step, the package implements efficient and flexible estimations of the GPS, allowing multiple user-specified modeling options. As the second step, the package provides two ways to adjust for confounding: weighting and matching, generating weighted and matched data sets, respectively. Lastly, the package provides built-in functions to fit flexible parametric, semi-parametric, or non-parametric regression models on the weighted or matched data to estimate the exposure-response function relating the outcome with the exposures. The computationally intensive tasks are implemented in C++, and efficient shared-memory parallelization is achieved by OpenMP API. This paper outlines the main components of the CausalGPS R package and demonstrates its application to assess the effect of long-term exposure to PM2.5 on educational attainment using zip code-level data from the contiguous United States from 2000-2016.
翻译:量化连续暴露对感兴趣结果的因果效应对于社会、经济、健康及医学研究至关重要。然而,现有软件包大多聚焦于二元暴露变量。我们开发了CausalGPS R包,该包实现了一系列算法,为连续暴露变量的因果推断提供算法解决方案。CausalGPS实现了一个以广义倾向性评分(GPS)为核心的因果推断工作流程,将倾向性评分(即在给定暴露前协变量条件下个体接受暴露的概率)从二元暴露扩展至连续暴露。作为第一步,该包实现了高效且灵活的GPS估计,允许用户指定多种建模选项。作为第二步,该包提供两种调整混杂的方法:加权和匹配,分别生成加权数据集和匹配数据集。最后,该包内置函数可在加权或匹配数据上拟合灵活的参数、半参数或非参数回归模型,用于估计暴露-反应函数(即结局与暴露之间的关系)。计算密集型任务通过C++实现,并利用OpenMP API实现高效共享内存并行化。本文概述了CausalGPS R包的主要组件,并演示了其应用:使用2000-2016年美国本土邮政编码层面数据评估长期暴露于PM2.5对教育程度的影响。