Introduction
In our last lesson, we focused on the crucial first step of counterfactual reasoning: formulating precise "what if" questions for your triadic system using the formal language of potential outcomes. We established that the core of computing an answer lies in a three-step algorithm: Abduction, Action, and Prediction. Today, we put that algorithm to work.
This lesson will guide you through the mechanics of computing counterfactual outcomes for each member of the vee triad. We will move from theory to application by specifying a concrete Structural Causal Model (SCM) for the relationship. You will learn how to use factual observations to infer the unobserved, latent characteristics of the triad, and then use that knowledge to predict their satisfaction under alternative living arrangements. We will explore both simple, deterministic cases and the more realistic probabilistic scenarios that arise when dealing with complex human systems.
1. The Mechanics of Counterfactual Computation
As we previewed, computing a unit-level counterfactual Y(t_cf) given a factual observation Y(t_fact) = y_fact requires a fully specified SCM. Let's revisit the three-step process, which is the engine of counterfactual inference.
- Abduction: Use the factual evidence (
t_fact,y_fact) to update your knowledge about the exogenous variablesU. TheseUvariables represent the stable, unobserved characteristics of the system—the triad's unique "relational physics." In an invertible model, you can solve forUexactly. In a non-invertible model, you derive a posterior distribution,P(U | evidence). - Action: Modify the SCM to represent the counterfactual world. This is achieved by applying the
do-operator, replacing the structural equation for the treatment variable with its counterfactual value,T := t_cf. - Prediction: Use the inferred knowledge of
Ufrom Step 1 and the modified model from Step 2 to compute the counterfactual outcome.
The following brief article section provides a crisp mathematical summary of this process with a simple example.
Causality in AI and Counterfactual Reasoning - Medium
This article provides a concise overview of the three-step process for computing counterfactuals using a Structural Equation Model (SEM).
Please read the section titled "Structural Equation Modeling and Counterfactual Prediction". Pay close attention to how the simple linear example maps directly onto the Abduction, Action, and Prediction steps.
2. A Deterministic Example: Linear SCM for the Vee Triad
Let's apply this process to a simplified model of your vee triad. Assume the following causal structure, where the pivot A's satisfaction directly influences the satisfaction of partners B and C, and the living arrangement T affects everyone.
- Units: Pivot
A, PartnerB, PartnerC. - Treatment
T: A binary variable whereT=1(all live together) andT=0(all live separately). - Exogenous
Us:U_A,U_B,U_Care latent, normally distributed variables representing each person's baseline satisfaction or disposition.U_A, U_B, U_C \sim \mathcal{N}(0, 1). - Outcomes
Ys:Y_A,Y_B,Y_Care the continuous satisfaction scores for each member.
We can specify a linear SCM as follows:
Here, the \alpha coefficients represent the direct effect of the living arrangement, and the \gamma coefficients model the interference—how A's satisfaction spills over to B and C. Let's assume we have estimated these parameters from prior data (a topic for a later module) and found: \alpha_A=2, \alpha_B=1, \alpha_C=1, \gamma_{AB}=0.5, \gamma_{AC}=0.4.
Now, let's compute a counterfactual.
Factual Scenario: The triad tries living separately (T=0), and you observe their satisfaction scores: Y_A = -0.5, Y_B = 1.0, Y_C = -0.8.
Counterfactual Question: What would their satisfaction scores have been if they had all lived together (T=1)?
Let's execute the three steps:
1. Abduction: We use the factual observations to solve for the specific values of U_A, U_B, U_C for this triad.
This abduction step has given us a window into the soul of this triad. We've inferred their latent characteristics (U_A=-0.5, U_B=1.25, U_C=-0.6). These values are fixed for this specific triad.
2. Action: We modify the SCM to represent the world where they live together by setting do(T=1). The equations become:
3. Prediction: We now predict the counterfactual outcomes by plugging in the inferred U values.
Our computation concludes that, for this specific triad with their unique latent traits, had they chosen to live together, their satisfaction scores would have been (Y_A=1.5, Y_B=3.0, Y_C=1.0).
3. Probabilistic Counterfactuals: The Non-Invertible Case
The linear model was convenient because the relationship between outcomes and latent variables was invertible, allowing us to pinpoint the exact values of U_A, U_B, U_C. In reality, this is rarely the case. For instance, if your satisfaction outcome Y is measured on a discrete 1-7 Likert scale, the function Y = f(U) is no longer invertible. Multiple values of a continuous latent variable U could map to the same discrete outcome Y=5.
When we cannot uniquely identify U, we cannot compute a single, deterministic counterfactual. Instead, we compute a probabilistic counterfactual: a probability distribution over the possible counterfactual outcomes. Your background in Bayesian methods is directly applicable here. The abduction step changes from solving an equation to performing Bayesian updating.
- Abduction (Probabilistic): Start with a prior distribution for
U,P(U). Use the factual evidenceE(e.g.,T=0, Y_A=5) to compute the posterior distributionP(U|E) \propto P(E|U)P(U). - Action: Modify the model to
do(T=1). - Prediction (Probabilistic): Propagate the posterior
P(U|E)through the modified SCM to get a distribution for the counterfactual outcomeP(Y(T=1) | E).
The video from our previous lesson explains this transition from a deterministic to a probabilistic result very clearly. A quick review will solidify the concept.
14.2 - Computing Counterfactuals
This video by Brady Neal details the mechanics of computing counterfactuals, explicitly handling both the invertible (deterministic) and non-invertible (probabilistic) cases.
Please re-watch the core of this video: The simple example demonstrates the invertible case, where U is uniquely determined. The general steps formally names the Abduction-Action-Prediction process. The non-invertible example is key. Notice how observation leads to a posterior distribution over U (e.g., 2/3 chance of "never happy," 1/3 chance of "dog hater"), which in turn yields a probability distribution for the counterfactual outcome. Finally, the segment on probabilistic steps summarizes the updated algorithm.
4. A Framework for Categorical Outcomes: Gumbel-Max SCMs
The probabilistic approach is powerful, but it requires us to choose a specific parametric form for our SCM. For categorical outcomes like your living arrangements (t_1, t_2, t_3) or Likert-scale satisfaction scores, what is a principled choice?
One elegant and powerful framework is the Gumbel-Max Structural Causal Model. This approach, common in discrete choice modeling, assumes that an agent selects the category j that maximizes a utility function log(p_j) + g_j, where p_j is the baseline probability of that category and g_j is an unobserved shock drawn from a Gumbel distribution.
In your context, you can model a person's satisfaction level as a "choice" from k possible levels. The probability of landing on level j depends on the treatment T and their latent Gumbel noise g_j.
- SCM:
Y = argmax_j {log(P(Y=j|T)) + g_j} - Abduction: When we observe
Y=iunder treatmentT, we don't know the exactgvalues. But we know thatlog(P(Y=i|T)) + g_iwas the highest utility. This constrains the possible values ofg, yielding a posteriorP(g | Y=i, T). - Action: We introduce a counterfactual treatment
T', which changes the probabilities toP(Y=j|T'). - Prediction: We take samples from the posterior
P(g | Y=i, T), add them to the new log-probabilitieslog(P(Y=j|T')), and find the newargmax. The distribution of these new argmaxes is our probabilistic counterfactual outcome.
This method is not just a computational trick; it has desirable theoretical properties. The following sections from Michael Oberst's thesis provide the formal details and a practical application. Given your background in stochastic processes and simulation, the idea of generating counterfactual trajectories by sampling from a posterior will feel very natural.
[PDF] Counterfactual Policy Introspection using Structural Causal Models
This text provides the formal basis for computing counterfactuals and introduces the Gumbel-Max SCM as a practical tool for categorical variables.
Please read the following sections: In Chapter 2, review the formal definition of the Counterfactual Distribution. This formalizes the Abduction-Action-Prediction process by defining the counterfactual distribution using the posterior P(U|X = x). In Chapter 4, read Section 4.3, "Gumbel-Max SCMs". This section introduces the model and explains how posterior inference works. This is a concrete recipe for implementing probabilistic counterfactuals. Finally, in Chapter 6, look at the example in Section 6.1.2, "Generating Counterfactual Trajectories". Focus on Figure 6-3. It beautifully illustrates the output of this process: the factual trajectory is a single path, while the counterfactual is a "fan" of possible paths, each corresponding to a draw from the posterior of the latent variables. This is exactly what you would compute for your triad.
The Gumbel-Max SCM provides a ready-made, theoretically sound engine for computing the counterfactuals central to your project. By simulating trajectories from the posterior, you can generate distributions of what might have happened for each member of the triad under each alternative living arrangement.
Conclusion
Today, we have transitioned from formulating counterfactual questions to computing their answers. You now have a complete toolkit for this task, grounded in the three-step algorithm of abduction, action, and prediction.
Key Takeaways:
- Computing unit-level counterfactuals requires a fully specified parametric SCM.
- In invertible (e.g., linear) models, you can perform abduction by solving for the exact values of the latent
Uvariables, yielding a single, deterministic counterfactual outcome. - In non-invertible (e.g., discrete outcome) models, abduction involves computing a posterior distribution over
U, resulting in a probabilistic counterfactual outcome. - The Gumbel-Max SCM offers a principled and practical framework for computing probabilistic counterfactuals for categorical variables, which is highly relevant for modeling choices and satisfaction levels in your triadic experiment.
In our next lesson, we will put these computed counterfactuals to use. You will learn how to leverage them to decompose the total causal effect of a living arrangement on an individual's satisfaction into its direct and indirect (spillover) components, allowing you to untangle the complex web of influence within the triad.