Vector Research Blog: Causal Effect Estimation Using Machine Learning
January 19, 2024
January 19, 2024
By Elham Dolatabadi, Maia Norman, Farnaz Kohankhaki, Rahul G. Krishnan, Deval Pandya, George-Kirollos Saad, Wen Xu, and Joanna Yu
Access the Causal Inference Laboratory GitHub repository here.
There is a growing interest in various domains, such as healthcare, retail, finance, and education, to answer causal rather than associative questions. This shift in focus reflects a recognition of the significance of understanding the underlying causal mechanisms that drive observed relationships. By developing a better understanding of causality, one can move beyond surface-level correlations and uncover the factors and interventions that truly impact outcomes. Causal analysis empowers decision-makers to make more data-driven and informed choices and ultimately drive meaningful change in their respective domains. We aim to make causal effect estimation frameworks easily accessible to developers, researchers, and innovators by providing an overview of the various components in a causal effect estimation workflow, and an explanation of how to implement state-of-the-art machine learning (ML) algorithms and toolkits for solving a wide variety of causal problems.
This material has been presented as a hands-on Causal Inference Laboratory organized by Vector, to enhance working knowledge of causal techniques and applications, and foster interdisciplinary collaboration among subject matter experts across diverse industries and sectors. The goal of the Laboratory was to facilitate the practical applications of causal effect estimation to diverse challenges, including estimation of treatment effect with real-world data in precision medicine, maximizing the efficiency of algorithmic trading across capital markets, churn prediction, supply chain optimization, and dynamic pricing. A core feature of this interactive Laboratory was the implementation of a causal effect estimation workflow. The workflow encompasses various aspects of causal effect estimation, such as model estimation and selecting appropriate estimation methods using techniques from recent research conducted by leading groups in the field.
Correlation means an association but not causation. Two variables could be statistically correlated but not necessarily causally linked. In this case, this type of association is confounding and both correlated variables are associated with a third variable, which is a causal variable and tends to co-occur with the data that weβre measuring.1 For instance, suppose there exists a positive correlation between the increase in ice cream sales and the number of shark attacks at the beach. One might mistakenly infer that buying more ice cream somehow contributes to a higher risk of shark attacks or vice versa. However, in reality, the correlation is likely due to the fact that both ice cream sales and shark attacks tend to increase during the summer months. Seasonality, with more people spending time at the beach during warm weather, is the common factor influencing both variables. The more people are at the beach (contributing to higher ice cream sales), the greater the chance of a shark attack occurring.
Therefore, any association is not necessarily causation and measuring causation is not as simple as measuring association. Traditional statistics and ML excel at the identification of associations among variables and the estimation of probabilities linked to past or future events. However, when it comes to understanding the actual cause-and-effect relationships between variables in dynamic and changing conditions, they fall short. Causal analysis goes beyond inferring probabilities and associations but also how probabilities change when conditions may dynamically shift. This could include changes induced by external interventions, treatments, or any other factors that influence the system being analyzed.2
As we learned above, there is a distinction between causal analysis and statistical analysis. In the context of causal analysis, the phrase βidentificationβ is referred to as the process of moving from a causal analysis to an equivalent statistical analysis. The process of building and estimating a causal effect, as shown in Figure 1, is a multi-step process consisting of establishing and then identifying the causal model which includes making assumptions to transform these into statistical models and applying various estimation methods to estimate the causal models that align with the chosen identification strategy. There is, therefore, a remarkable surge in interest in developing methodologies for constructing causal models and effectively identifying causal effects from observational data. Recent advances in ML and deep learning have provided researchers with powerful tools to navigate the complexities related to estimating causal effects.3-7 These techniques offer flexibility, automation, and scalability, enabling more accurate and insightful causal effect estimations from observational data.
It is important to note that multidisciplinary teamwork, including subject matter experts, is critical to the process of building a robust causal effect estimation model. Collaboration between domain knowledge experts and ML engineers ensures that the research questions are well-defined, the study design is appropriate, the analysis accounts for relevant factors, and the results are correctly interpreted in the context of the subject matter.
Our Causal Effect Estimation Workflow guide, below, provides a detailed overview of the technical modules included in our causal effect estimation workflow summarized in Figure 1, including leveraging estimators such as conditional outcome modeling, representation learning, and double machine learning to identify, estimate and evaluate causal models from real-world observational data, demonstrated on three real-world datasets.
In this work, we focus on the problem of causal effect estimation under the Rubin-Neyman potential outcomes framework with conditional unconfoundedness8. The observed data consists of samples of random variables (π, π, π, π) from an unknown distribution, where π represents all of the observed covariates, π represents the treatment assignment, π represents the outcome of interest, and π represents the confounders satisfying the backdoor criterion relative to π and π (where π blocks all backdoor paths from π to π and does not contain any descendants of π).9 We consider only binary treatments π β {0, 1}. Hence, we have two potential outcomes π (1) = π (do(π = 1)) and π (0) = π(do(π = 0)). This study focuses on estimating the Treatment Effect, which is a prevalent causal effect problem encompassing the impact of treatment on the individual or population level.
We denote the individual treatment effect (ITE) with πi which is mathematically defined as:
πi βπi(1) β πi(0)
Due to the fundamental problem of causal inference, we canβt access individual treatment effects (we cannot observe both Yi(1) and Yi(0)). But we can estimate the average treatment effect (ATE), π, which is measured by taking the average over ITE:
π βπΌ[πi(1) β πi(0)] = πΌ[πi(do(π = 1)) β πi(do(π = 0))]
In order to make the treatment effects identifiable3, 10, 11 we posit the three assumptions of Consistency (π = π.π (1)+(1βπ )π (0)), Conditional Ignorability (π (0), π (1) γ π|π) and Overlap (0 < βΌ(π€) < 1, β π€ β π):
π βπΌπ€[πΌ[π|π = 1, π = π€] β πΌπ€πΌ[π|π = 0, π =π€]]
We denote ΞΌ(π€) as an expected potential outcome and Ο(π€) as a propensity score as follows:
The model estimation within our workflow supports building multiple groups of estimators for the identified causal estimands. The first two groups of estimators, Conditional Outcome Modeling (COM) and Grouped Conditional Outcome Modeling (GCOM), leverage a range of linear and non-linear ML models, including ordinary least squares, random forests, and feed-forward neural networks. Furthermore, our workflow includes implementations of representation learning based estimators such as TARNet5 and DragonNet6 based on deep learning techniques. Additionally, we provide other data efficient models using the Double ML framework,4 all of which are accompanied by a dedicated pipeline explicitly designed for hyperparameter tuning.
COM estimators12, which are also called βS-learnerβ, or βG-computation estimatorsβ in the literature, involve fitting a single estimator that models outcome variables, π, as a function of concatenated treatment assignment and other relevant covariates. Using COM, the goal is to fit an estimator, π(π΅, π€), to the conditional expectation, πΌ[π |π = π΅, π = π€], which could be a statistical model or an ML model. More precisely, the ATE is the empirical mean, πΌπ€, over the n sample observation data points:
GCOM appears to address the issue of zero ATE; however, it introduces another downside by not utilizing all of the available data for model training.
One significant drawback of COM estimators is their potential to overlook the treatment variable, especially in scenarios where the confounding variables are high-dimensional. This can lead to biased COM estimation and an ATE of zero.13
GCOM13 estimators, which are also called βT-learnerβ, involve building two separate models π1(π€) and π2 (π€) predicting π from π in group one where π = 1 and in group two where π = 0, respectively. For the binary treatment, the ATE is defined as:
Like other domains, the field of causal estimation also benefits from advancements in deep learning. Causal estimation models rooted in deep neural networks are designed to address the shortcomings through learning complex nonlinear representations of observational data. Intuitively, these models trade off two objectives: improving the prediction accuracy of factual and counterfactual outcomes while minimizing the distance between the distribution of the treatment population and that of the control population. Two notable approaches are TARNet5 and DragonNet.6 TARNet is a two-headed neural network architecture consisting of a single deep neural network that is followed by two distinct sub-networks, each dedicated to a specific treatment group. The single network is a COM estimator, π(π΅, π€), leveraging the entire observation to learn a treatment-agnostic representation. Conversely, the sub-networks utilize the relevant subset of the representation specific to each treatment group to predict the outcome variable, π. DragonNet, akin to TAR-Net, is a deep neural network model that incorporates an additional head for estimating the propensity score, Ο(π€), in addition to the COM estimation, π(π΅, π€), accomplished by the other two heads. The third head in the network acts like a regularizer and trades off prediction quality to achieve a better representation of the propensity score.
The concept of double/debiased machine learning or Double ML (DML) also known as R-learner4 has emerged as a method to achieve an unbiased estimation of causal effects using ML models. What sets DML apart is its ability to provide confidence interval guarantees and rapid convergence rates. Unlike TARNet5 and DragonNet,6 where the backbone ML models are typically neural networks and treatments are typically binary or discrete, DML offers the flexibility to utilize diverse ML models and accommodate continuous treatments. In DML, we employ a two-stage process to fit the following partial linear model.
Ο
(π€), to predict treatment, π, from covariates, π. For both estimations we can leverage ML and the reason it is called double ML is that we use ML twice.Then, we fit a model to predict the residuals of outcome values, ui, using the residuals of treatment values, πi to get the estimated Ξ²1 and therefore ATE.
Model selection poses a significant challenge in causal effect estimation due to the fundamental problem of not being able to observe counterfactuals directly. This distinguishing characteristic makes the model selection task in causal effect estimation more complex than in other ML and statistical approaches. Therefore, the commonly used cross-validation approach is impractical. Instead, proxy metrics based on auxiliary nuisance models and the utility of decision policy based on the heterogeneous treatment effect of estimators have been proposed in the literature.14 The model selection module within our framework enables the building of various evaluation metrics tailored to three distinct groups of datasets, including semi/fully synthetic datasets, randomized control trials, and real-world observational datasets.
Two widely used evaluation metrics for known counterfactuals and ground truth ATE are the expected precision in the estimation of heterogeneous effects (PEHE)15 and absolute error in ATE, respectively. Expected PEHE, βPEHE, quantifies the ability of a model to capture the heterogeneity of the causal effects of treatment among individuals in a population, which measures the discrepancy between the estimated and ground truth treatment effects at the individual level:
Limited access to heterogeneous treatment effects at the individual level and the availability of a ground truth ATE in randomized control trials have led to the adoption of absolute error in ATE, βATE
This class of metrics denoted as π constructs an approximate ground truth treatment effect using nuisance models in the absence of counterfactuals which provides the βtrue,β but technically unobserved treatment effect. The approximation-based metrics quantify the heterogeneity disparity between the estimated treatment effects and the approximated values in a manner analogous to PEHE. With an exception made for estimators like Double ML, which are unable to estimate heterogeneous treatment effects, the discrepancy between the ATE and the approximated ATE can be evaluated. A lower value indicates a better alignment between the estimates and the approximations:
where πPEHE denotes approximation-based metrics for estimation of heterogeneous effects and πATE for estimation of average treatment effects.
There are four commonly employed approaches for approximating the ground truth treatment effect: matching,16 weighting,11 modelling,17 and influence function.17 Matching includes finding the nearest neighbour (nn) from the opposite treatment group for each sample in the observation based on their covariates values. The matching treatment effect is defined as the difference between the observed outcomes among nearest neighbour samples.
Another common approach to approximate the ground truth treatment effect is weighting using Inverse Propensity Weighting (IPW). Using IPW, we can construct a pseudo population in which the distributions of outcomes are balanced between the two treatment groups. The weighting treatment effect is then defined as:
Additionally, we can employ regression models as in COM (S-learner) and GCOM (T-learner) estimators, both of which are referred to as plug-in PEHE methods17 to approximate the ground truth ITE as follows:
According to Alaa & Van Der Schaar,17 the modelling or plug-in PEHE methods can truly demonstrate their comparative performances only when the differences between them are sufficiently small, i.e., π~0. Otherwise, when the differences are significant, they tend to exhibit a bias depending on the model being used. To overcome this limitation, influence functions were proposed to obtain unbiased estimates of PEHE and its variance. These influence functions capture the functional derivatives of the causal effect and provide more robust and generalizable metrics. In the context of the GCOM plug-in PEHE, an additional term incorporating an influence function based on a Taylor-like expansion is defined as follows:
The original Infant Health and Development Program (IHDP) is a randomized controlled study designed to evaluate the effect of home visits from specialist doctors on the cognitive test scores of premature infants. The dataset eventually was transformed from a randomized design to an observational setting and emerged as a widely used benchmark for causal estimation.15 The transformation included inducing selection bias by removing non-random subsets of the treated individuals so the treatment. Additionally, the outcomes were simulated using the original covariates and treatments. The benchmarking dataset consists of 747 subjects and 25 variables. The treatment refers to Home visits by specialists, and the outcomes of interest are cognitive test scores. The dataset includes up to 100 realizations for both factual and counterfactual outcomes. Following Hill,15 we used the noiseless outcome as the true outcome for building estimators in our experiments. We report the treatment effects averaged over 100 realizations of the factual and counterfactual outcomes with 80/20 train/test splits.
The Jobs dataset, introduced by LaLonde,18 is a widely used benchmark in the causal effect estimation community. In this dataset, the treatment refers to job training, and the outcomes of interest are employment status following the training. The dataset includes 8 covariates, including age, education, and previous earnings. Following Shalit et al.,5 we combined the LaLonde experimental sample (297 treated, 425 control) with the PSID comparison group (2490 control).
The TWINS dataset, covering twin births in the USA from 1989 to 1991,19 is predominantly geared towards investigating relative weightβs impact on twinsβ mortality rate. As a benchmark for causal effect estimation,11 the dataset employs an artificial binary treatment, specifically being heavier at birth. The binary outcome measures the mortality of each twin during their first year. Since the dataset provides records for both twins, we treat their outcomes as two potential outcomes based on the treatment assignment of being born heavier or not. This setup allows for causal effect estimation analyses regarding the effect of relative weight on twin mortality rates. The dataset has 23968 samples (11984 treated, 11984 control) and 46 covariates relating to the parents, the pregnancy and birth.
For each dataset, we present evaluations encompassing a range of causal estimators in Tables 1, 2, and 3 for IHDP, Jobs, and TWINS, respectively. The evaluations are the average and standard deviation of precision and approximation-based metrics over 10 runs using our frameworkβs model selection module. With the exception of Double ML, all approximation-based results, πPEHE, presented in the table are associated with the estimation of heterogeneous (individual) treatment effects on out-of-sample or test sets. However, the metrics for Double ML, πATE, relate to average treatment effects, and their values are not within the same range as other estimators and cannot be compared directly.
Using the approximation-based metrics, we adopt the subsequent procedure to identify the optimal estimator when access to the ground truth treatment effects is unavailable: first, for each metric derived from approximations, we opt for the lowest value exhibiting the least mean. Second, the estimators exhibiting the majority of these lower values will then be chosen as the best estimators. The bolded metrics in the tables below are those which satisfy the specified conditions as outlined.
An interesting observation within the IHDP dataset in Table 1 emerges, wherein the performance metrics remain consistently aligned across all estimators, albeit showing minor fluctuations. Notably, DragonNet and Double ML stand out by showcasing superior performance compared to the other estimators, with a marginal difference though. As we can see in Table 2, on the Jobs dataset, based on βATE using the ground truth data, COM ordinary least squares outperform other estimators. Nonetheless, following our above-mentioned model selection strategy based on approximate metrics, COM random forest regression demonstrates impressive performance in estimating the PEHE across all nuisance models. TWINS dataset, as shown in Table 3, reveals a pattern similar to that of the IHDP dataset. Across all estimators, the performance measures consistently showcase a remarkable level of coherence. However, COM ordinary least squares outperformed other estimators based on both precision and approximation metrics.
In conclusion, we hoped to provide a comprehensive overview of our causal effect estimation workflow by detailing the intricacies of each component and their implementations across various experiments. We hope this will assist researchers and innovators in effectively applying and implementing causal concepts and advance real-world applications of causal effect estimation.
We would like to recognize the valuable technical and theoretical contributions of participants in the Causal Inference Laboratory, as well as the contributions of the individuals named below:
Academic and Project Advisors
Vahid Balazadeh Meresht1, Rahul G. Krishnan1,2+Λ@<, Deval Pandya2+@<%, Andres
Rojas2+<%
Vector Project Team
Elham Dolatabadi1,2,3+β§&@βΌ<>, Amirmohammad Kazemeini2<>@%, Farnaz Kohankhaki2>, Maia Norman2,4+&@<>%, George Saad2β§&@>, Wen Xu2β§&@>, Joanna Yu2@<>
Laboratory Facilitators
Dami Aremu2>, Winnie Au2<>, Asic Chen1>, Michael Cooper1>, Shaaf Farooq2>, Sedef Kocak2>, Tahniat Khan2>, Umar Khan2>, Farnam Mansouri4>, Shayaan Mehdi2>, Amirmohammad Shahbandegan2>, Ian Shi1>