In the framework of structural causal models, counterfactual queries describe events that concern multiple alternative states of the system under study. Counterfactual queries often take the form of "what if" type questions such as "would an applicant have been hired if they had over 10 years of experience, when in reality they only had 5 years of experience?" Such questions and counterfactual inference in general are crucial, for example when addressing the problem of fairness in decision-making. Because counterfactual events contain contradictory states of the world, it is impossible to conduct a randomized experiment to address them without making several restrictive assumptions. However, it is sometimes possible to identify such queries from observational and experimental data by representing the system under study as a causal model, and the available data as symbolic probability distributions. Shpitser and Pearl (2007) constructed two algorithms, called ID* and IDC*, for identifying counterfactual queries and conditional counterfactual queries, respectively. These two algorithms are analogous to the ID and IDC algorithms by Shpitser and Pearl (2006) for identification of interventional distributions, which were implemented in R by Tikka and Karvanen (2017) in the causaleffect package. We present the R package cfid that implements the ID* and IDC* algorithms. Identification of counterfactual queries and the features of cfid are demonstrated via examples.
翻译:在结构因果模型框架下,反事实查询描述了涉及研究对象多种可能状态的事件。此类查询常以"如果...会怎样"的形式呈现,例如:"若申请人实际仅有5年工作经验,却拥有超过10年经验时,是否会被录用?"这类问题及其广义的反事实推理在解决决策公平性问题等领域具有关键意义。由于反事实事件包含现实世界的矛盾状态,若不做出若干严格假设,无法通过随机实验加以处理。但通过将研究对象表示为因果模型、将可用数据表示为符号概率分布,有时可从观察数据和实验数据中识别此类查询。Shpitser和Pearl(2007)构建了两种算法——ID*和IDC*,分别用于识别反事实查询和条件反事实查询。这两种算法与Shpitser和Pearl(2006)为识别干预分布而提出的ID和IDC算法类似,后者已由Tikka和Karvanen(2017)在causaleffect包中基于R语言实现。本文介绍实现ID*和IDC*算法的R包cfid,并通过实例演示反事实查询的识别过程及cfid的功能特性。