Example: Augmented Simpson’s Paradox
Now that we have seen how to estimate the Average Causal Effect by manually interacting with BayesiaLab’s Monitors, with both Graph Surgery and Likelihood Matching, we will use BayesiaLab’s Direct and Total Effect functions to compute causal effects automatically for a set of variables. But first, we present a slightly more complex version of Simpson’s Paradox to illustrate these features (see Example: Simpson’s Paradox).
Augmented Simpson’s Paradox
Our updated story contains four additional dimensions:
- : the treatment is not always available;
- : the treatment may produce severe side effects;
- : some patients do not respond to the drug;
- : the families of patients who died may sue the pharmaceutical company that had provided the treatment.
The manually designed CDAG shown below describes this new domain qualitatively:
Next, we describe the quantitative part of the domain. First, we state that is 75%. The model assigns equal prior probabilities to and . We also assume that the treatment may have , which are much more frequent for females. The following conditional probability table quantifies this direct causal dependency on :
Patients decide whether or not to take the treatment based on two criteria, and . The dependencies are described in the following table. It states that if the treatment is unavailable, patients cannot have the treatment, which is deterministic (and obvious). However, if the treatment is available, those patients who do not have any risk of experiencing side effects will always choose the treatment, while those at risk will be unlikely to submit to the treatment:
Furthermore, the of the treatment depends on plus some hidden factors that render the treatment ineffective in 20% of patients:
The Target Node, , is defined by and . In this context, means that the patient died.
Finally, half of the families of those patients who took the treatment and died are pursuing litigation. More specifically, these families are suing the pharmaceutical company that provided the treatment.
Path Analysis
We now list the paths between each variable and the target variable by using Menus > Analysis > Visual > Graph > Influence Paths to Target. The Causal column marks the directed causal paths to . The six tabs show all 12 paths, grouped by their starting node.
To show one path on the graph, select its row, check Keep Arc Color and Thickness, and click OK. Before displaying the next path, choose Menus > Edit > Select Arcs > All, then right-click a selected arc and choose Properties > Edit All > Default.
Gender

Recall the Adjustment Criterion, which stipulates that we must keep all of a variable’s causal paths to the target variable open and simultaneously block all its non-causal paths for estimating its causal effect.
Graph Surgery
To illustrate BayesiaLab’s Total and Direct Effects functions with Graph Surgery, we set all nodes but to Intervention Mode.
Notice the arrow symbols (→) in the badges of the nodes that are set to Intervention Mode.
Average Causal Effect
Before using BayesiaLab’s automated tools for computing causal effects, we manually estimated the causal effect of our main variable of interest, , by using the Monitors.
Setting a piece of Evidence in Intervention Mode simulates an intervention on and mutilates the graph, as shown below, which meets the Adjustment Criterion by blocking the non-causal path (see Path Analysis).
The Average Causal Effect of on , mediated by , is .
Total Effects
We have seen in Chapter 8 that BayesiaLab estimates Total Effects as the derivatives of Total Effect Curves. These curves are based on the Posterior Mean Values of the Target Node given Mean Values from the interval of the variable under study. While the variables are in Intervention Mode, the Posterior Mean Values are computed based on the mutilated graph.
We can plot these curves with Menus > Analysis > Visual > Target > Target's Posterior > Curves > Total Effects.

For generating this graph, we can set a number of options:

The x-axis, Variable Delta Means, represents the difference between the Mean Value generated for the analysis (here, Hard Evidence/Intervention on the states of the variable under study) and its Prior Mean Value. The y-axis represents the difference between the Posterior Mean Value of and its Prior Mean Value.
If we do not specifically associate numerical values with symbolic states, BayesiaLab uses the state index. In our example,
- is 0, and is 1.
- is 0, and is 1.
- is 0, and is 1.
We see that is the only variable with a positive causal effect. We also notice that has no causal effect. Here the binary drivers and target are coded 0 and 1. With Use Hard Evidence selected, the two evaluations for each driver give its endpoint contrast. For this intervention with the remaining mechanisms fixed, the mean response to a mixture of the two driver states is linear in their mixing probability. Its slope therefore equals that contrast. Open Total Effects on Target from Menus > Analysis > Report > Target > Total Effects on Target.

The Total Effect is the derivative computed at in the previous Target Mean Analysis graph, i.e., the slope of the curve. The Standardized Total Effect is the Total Effect times the ratio between the standard deviation of the variable and the standard deviation of the Target Node.
The arrow symbols (→) in the results table indicate that Intervention Mode was active on all nodes, triggering Graph Surgery upon each observation/intervention during the estimation of the effects.
is the variable with the strongest Total Effect. It is negative because of the index values of the states. The recovery rate for (1) is lower than for (0).
Note that there are two paths from to (see Path Analysis), and they are both causal. is indeed a root node, i.e., it has no parents, meaning the Adjustment Criterion is fulfilled by default.
The Total Effect measures the effects of these two causal paths: the direct path and the indirect path, represented by the blue arcs below.
Direct Effects
Now consider the effect that reaches without passing through a mediator. With every node in this causal network in Intervention Mode, the Direct Effects calculation automatically fixes the distributions of all Confounders in the analysis. In particular, it fixes . The Total Effects calculation above allowed that mediator to respond. To see the resulting Direct Effect Curves, choose Menus > Analysis > Visual > Target > Target's Posterior > Curves > Direct Effects with the same settings used for Total Effects.

Given that all nodes are in Intervention Mode, the only variables with Direct Effects are the Parents of . Indeed, intervening on all nodes to hold them constant triggers Graph Surgery and generates the mutilated graph below:
The Direct Effects on Target report summarizes these curves. Choose Menus > Analysis > Report > Target > Direct Effects on Target.

- The Direct Effect gives the local slope in original units. In this binary intervention example, that slope also equals the difference between the two endpoint means.
- The Standardized Direct Effect is the Direct Effect times the ratio between the standard deviation of the variables and the standard deviation of the Target Node.
- The Elasticity is the Direct Effect times the ratio between the range of the variable and the range of the Target Node.
- Contribution gives each selected driver’s share of the sum of the absolute Standardized Direct Effects. Both positive and negative slopes contribute to the total magnitude.
Non-Confounders
The predefined class lets us choose which nodes to exempt from the automatic fixing. The Direct Effect definition lists the class rules. The only directed path from to passes through . With the mediator fixed, the drug’s reported Direct Effect is zero. To let that path carry the drug’s effect, open the contextual menu for , choose Properties > Classes > Add Predefined Class, and select . The graph below shows which arcs are then available for estimating the effect.

The Direct Effects report now gives −0.0800 for . This equals the total causal effect obtained earlier by intervention. Recovery falls from 50% without treatment to 42% with treatment. Freeing the mediator restores those eight percentage points in the comparison. is no longer listed as a driver in this run.
Likelihood Matching
Now suppose we want to use Likelihood Matching instead of Graph Surgery. We first set back all nodes in Observation Mode via the monitors’ Contextual Menus.
Nodes of Interest: Treatments/Drivers
The nodes of interest are the nodes for which we want to estimate the causal effect on the Target Node. We call them Treatments or Drivers.
In the previous section, we assumed that all nodes were of interest and set them in Intervention Mode. With Likelihood Matching, the workflow is less straightforward. For each Driver, we need to analyze the paths to the Target (cf. Path Analysis) to define the set of nodes that need to be controlled for to block the non-causal paths and let the causal paths open. Note that these nodes’ sets may differ for each Driver, requiring us to perform multiple Total Effect analyses to avoid conflicting adjustments. The first step is then to define our nodes of interest. In the Augmented Simpson Paradox, the main variable of interest is obviously , but for illustrative purposes, let us consider as well.
Total Effects
We have seen in the Path Analysis section that there are two paths between and , both causal. Thus, there is no variable to adjust for to estimate the Total Effect.
The Path Analysis indicates that there are also two paths between and , one causal and one non-causal: ← ← → . So we need to adjust for , or for , to block this path. This is in contradiction to the analysis of ‘s effect. We cannot estimate the Total Effects of and in the same analysis with Likelihood Matching!
So let us start with . We select the node, go to Menus > Analysis > Report > Target > Total Effects on Target, and confirm that we want to perform the analysis on the selected node only:

For , let us suppose we choose to adjust for . We right-click on its associated Monitor and select Fix Probabilities from its Contextual Menu.
Then, we select the node , go to Menus > Analysis > Report > Target > Total Effects on Target, and confirm that we want to perform the analysis on the selected node only:

Direct Effects
In Observation Mode, the Direct Effects calculation automatically maintains the marginal distributions of all Confounders through Likelihood Matching. The causal interpretation depends on which variables we allow to respond. Graph Surgery cuts incoming arcs to an intervened node. Likelihood Matching instead sets evidence to maintain the chosen distribution. In this graph, is a descendant of . Fixing its distribution by evidence would distort the recovery contrast, so we also exempt it.
While we previously added to the class to let it mediate the effect of , we must also add to prevent its adjustment.
Notice that there is no conflict in this analysis:
- Gender
- Controlling for , allows to cut the indirect causal path;
- Controlling for has no impact;
- Not controlling for has no effect as the indirect path is already blocked;
- Not controlling for prevents to bias the estimation of the effect;
- Drug Administration
- Controlling for , allows to cut the non-causal path;
- Controlling for has no impact;
- Not controlling for allows to let the information flow from to ;
- Not controlling for prevents to bias the estimation of the effect.
We can, therefore, select our two nodes of interest, use Menus > Analysis > Report > Target > Direct Effects on Target, and confirm that we want to perform the analysis on the selected nodes only:

Graph Surgery Versus Likelihood Matching
Before concluding this chapter, let us summarize the main characteristics of Graph Surgery and Likelihood Matching:
- Graph Surgery
- requires a fully specified Causal Bayesian Network;
- uses the mutilated Causal Bayesian Network for causal inference;
- Likelihood Matching
- requires the causal analysis of the domain to define the variables that need to be adjusted for to block the non-causal paths and let the causal paths open;
- uses the Bayesian network to carry out probabilistic inference with the adjusted variables. Note that this network does not have to be causal! It just needs to represent the Joint Probability Distribution of the domain.
This last point is especially important. It is indeed sometimes challenging, if not impossible, to design the fully specified Causal Bayesian Network. However, BayesiaLab offers a wide range of machine-learning algorithms that we can use to induce a network that represents the Joint Probability Distribution. Hence, we only need to have a limited amount of causal knowledge to define the variables that have to be adjusted for.
For this example, we generated a CSV of 64,000 records from the causal network. Each combination of states occurs in proportion to its joint probability. The G-tests in the reports use these generated counts. With as the target, we selected Menus > Learning > Supervised Learning > Augmented Naive Bayes, used Delete All Arcs, and left Variable Selection unchecked.
The main architecture of the network is Naïve, i.e., the Target Node is the parent of all nodes. Therefore, this Bayesian network is clearly not causal. If we were to use Graph Surgery, we would not find any total or direct effects (see the corresponding mutilated graph below when estimating the Direct Effects with and in the class).
Likelihood Matching estimates the Total Effects in two separate analyses.
For , the Total Effect is without adjustment:

For , fixing at its prior distribution gives a Total Effect of , close to the obtained by intervention:

For Direct Effects, we can analyze both variables together with and in the class. The learned network gives for and for . The corresponding estimates in the causal network are and .

Conclusion
This chapter highlights how much effort is required to derive causal effect estimates from observational data. Simpson’s Paradox illustrates how much can go wrong even in simple circumstances. Given such potentially serious consequences, it is a must for policy analysts to examine all aspects of causality formally. To paraphrase Judea Pearl, we must not leave causal considerations to the mercy of intuition and good judgment. Fortunately, causality has emerged from its pariah status in recent decades, which has allowed tremendous progress in theoretical research and practical tools: “[…] practical problems relying on causal information that long were regarded as either metaphysical or unmanageable can now be solved using elementary mathematics” (Pearl, 1999).




