![Revisit consent button](../images/body-df29beacd7496220cc94.svg)
We value your privacy
We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.
Customise Reject All Accept All
Customise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)
We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.
The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more
NecessaryAlways Active
Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.
  * Cookie
BCTempID
  * Duration
10 minutes
  * Description
No description available.


  * Cookie
__cf_bm
  * Duration
1 hour
  * Description
This cookie, set by Cloudflare, is used to support Cloudflare Bot Management. 


  * Cookie
AWSALBCORS
  * Duration
7 days
  * Description
Amazon Web Services set this cookie for load balancing.


  * Cookie
_cfuvid
  * Duration
session
  * Description
Cloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services


  * Cookie
li_gc
  * Duration
6 months
  * Description
Linkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.


  * Cookie
__hssrc
  * Duration
session
  * Description
This cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.


  * Cookie
__hssc
  * Duration
1 hour
  * Description
HubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.


  * Cookie
wpEmojiSettingsSupports
  * Duration
session
  * Description
WordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.


  * Cookie
BCSessionID
  * Duration
1 year 1 month 4 days
  * Description
Blueconic sets this cookie as a unique identifier for the BlueConic profile.


  * Cookie
_octo
  * Duration
1 year
  * Description
No description available.


  * Cookie
logged_in
  * Duration
1 year
  * Description
No description available.


  * Cookie
__Secure-YEC
  * Duration
past
  * Description
YouTube sets this cookie to stores the user's video player preferences using embedded YouTube video


  * Cookie
__eoi
  * Duration
6 months
  * Description
Description is currently not available.


  * Cookie
AWSALBTGCORS
  * Duration
7 days
  * Description
No description available.


  * Cookie
login-status-p
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
AWSALBTG
  * Duration
7 days
  * Description
No description available.


  * Cookie
csrf_token
  * Duration
session
  * Description
No description available.


  * Cookie
token_v2
  * Duration
1 day
  * Description
Description is currently not available.


  * Cookie
D
  * Duration
1 year
  * Description
Description is currently not available.


  * Cookie
PHPSESSID
  * Duration
session
  * Description
This cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.


  * Cookie
VISITOR_PRIVACY_METADATA
  * Duration
6 months
  * Description
YouTube sets this cookie to store the user's cookie consent state for the current domain. 


  * Cookie
cookietest
  * Duration
session
  * Description
The cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.


  * Cookie
__Host-airtable-session
  * Duration
1 year
  * Description
This cookie is used to enable us to integrate the services of Airtable.


  * Cookie
__Host-airtable-session.sig
  * Duration
1 year
  * Description
This cookie is used to enable us to integrate the services of Airtable.


  * Cookie
m
  * Duration
1 year 1 month 4 days
  * Description
Stripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.


  * Cookie
BIGipServer*
  * Duration
session
  * Description
Marketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. 


  * Cookie
__cfruid
  * Duration
session
  * Description
Cloudflare sets this cookie to identify trusted web traffic.


  * Cookie
_GRECAPTCHA
  * Duration
6 months
  * Description
Google Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.


  * Cookie
__Secure-YNID
  * Duration
6 months
  * Description
Google cookie used to protect user security and prevent fraud, especially during the login process.


  * Cookie
cookieyes-consent
  * Duration
1 year
  * Description
CookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.


Functional
Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
  * Cookie
lidc
  * Duration
1 day
  * Description
LinkedIn sets the lidc cookie to facilitate data center selection.


  * Cookie
brw
  * Duration
1 year
  * Description
No description available.


  * Cookie
brwConsent
  * Duration
5 minutes
  * Description
Description is currently not available.


  * Cookie
WMF-Uniq
  * Duration
1 year
  * Description
Description is currently not available.


  * Cookie
loom_anon_comment
  * Duration
1 year
  * Description
No description available.


  * Cookie
loom_referral_video
  * Duration
session
  * Description
Description is currently not available.


  * Cookie
VISITOR_INFO1_LIVE
  * Duration
6 months
  * Description
A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.


  * Cookie
yt-remote-connected-devices
  * Duration
Never Expires
  * Description
YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.


  * Cookie
ytidb::LAST_RESULT_ENTRY_KEY
  * Duration
Never Expires
  * Description
The cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.


  * Cookie
yt-remote-device-id
  * Duration
Never Expires
  * Description
YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.


  * Cookie
yt-remote-session-name
  * Duration
session
  * Description
The yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.


  * Cookie
yt-remote-fast-check-period
  * Duration
session
  * Description
The yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.


  * Cookie
yt-remote-session-app
  * Duration
session
  * Description
The yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.


  * Cookie
yt-remote-cast-available
  * Duration
session
  * Description
The yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.


  * Cookie
yt-remote-cast-installed
  * Duration
session
  * Description
The yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.


  * Cookie
cp_session
  * Duration
3 months
  * Description
Codepen sets this cookie for Help systems found in the website.


  * Cookie
loid
  * Duration
1 year 1 month 4 days
  * Description
This cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.


Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.
  * Cookie
__hstc
  * Duration
6 months
  * Description
Hubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).


  * Cookie
hubspotutk
  * Duration
6 months
  * Description
HubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.


  * Cookie
_ga
  * Duration
1 year 1 month 4 days
  * Description
Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.


  * Cookie
_ga_*
  * Duration
1 year 1 month 4 days
  * Description
Google Analytics sets this cookie to store and count page views.


  * Cookie
__Host-psifi.analyticsTrace
  * Duration
6 hours
  * Description
Description is currently not available.


  * Cookie
__Host-psifi.analyticsTraceV2
  * Duration
6 hours
  * Description
Description is currently not available.


  * Cookie
_gh_sess
  * Duration
session
  * Description
GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.


  * Cookie
YSC
  * Duration
session
  * Description
YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.


  * Cookie
ajs_anonymous_id
  * Duration
1 year
  * Description
This cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.


  * Cookie
vuid
  * Duration
1 year 1 month 4 days
  * Description
Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. 


Performance
Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.
  * Cookie
AWSALB
  * Duration
7 days
  * Description
AWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.


  * Cookie
acq
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
acq.sig
  * Duration
past
  * Description
Description is currently not available.


  * Cookie
ptc
  * Duration
2 years
  * Description
No description available.


Advertisement
Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.
  * Cookie
muc_ads
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to collect user behaviour and interaction data to optimize the website.


  * Cookie
guest_id_marketing
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor.


  * Cookie
guest_id_ads
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor.


  * Cookie
personalization_id
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.


  * Cookie
guest_id
  * Duration
1 year 1 month 4 days
  * Description
Twitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.


  * Cookie
bcookie
  * Duration
1 year
  * Description
LinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.


  * Cookie
__Secure-ROLLOUT_TOKEN
  * Duration
6 months
  * Description
YouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.


  * Cookie
yt.innertube::nextId
  * Duration
Never Expires
  * Description
YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.


  * Cookie
yt.innertube::requests
  * Duration
Never Expires
  * Description
YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.


  * Cookie
session_tracker
  * Duration
session
  * Description
This cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.


  * Cookie
edgebucket
  * Duration
session
  * Description
Reddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.


  * Cookie
did
  * Duration
1 year
  * Description
Arbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.


Uncategorised
Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet.
No cookies to display.
Reject All Save My Preferences Accept All
Toggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation
[](https://towardsdatascience.com/)
Publish AI, ML & data-science insights to a global community of data professionals.
Sign in[Submit an Article](https://write.insightmediagroup.io)
[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)
* * *
[Write For TDS](https://towardsdatascience.com/submissions/)
[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search
[Data Science](https://towardsdatascience.com/category/data-science/)
# Causal Diagram: Confronting the Achilles' Heel in Observational Data
"The Book of Why" Chapters 3&4, a Read with Me series
[Zijing Zhu, PhD](https://towardsdatascience.com/author/zzhu17/)
November 23, 202313 min read
![](../images/000.jpg)
Causal Diagram: Confronting the Achilles' Heel in Observational Data
In my previous two articles, I [kicked off](https://medium.com/towards-data-science/read-with-me-a-causality-book-club-edd7085d6ae6) the "Read with Me" series and finished reading the [first two chapters](https://towardsdatascience.com/data-tells-us-what-and-we-always-seek-for-why-66da7dc3f24d) from "[The Book of Why](https://www.amazon.com/Book-Why-Science-Cause-Effect/dp/046509760X)" by Judea Pearl. These articles discuss the necessity of introducing causality in enabling human-like decision-making and emphasize the Ladder of Causation that sets up the foundation for future discussions. In this article, we will explore the keyholes that open the door from the first to the second rung of the ladder of causation, allowing us to move beyond probability and into causal thinking. We will go from Bayes's rule to the Bayesian network to, finally, the causal diagrams.
* * *
# From Bayes's rule to inverse probability
As a fan of detective novels, my favorite series is Sherlock Holmes. I still remember all these days and nights I read them without noticing time passing by. Years later, lots of the case details had already disappeared from my memories, but I still remember the famous quotes like everyone else:
> **When you have eliminated the impossible, whatever remains, however improbable, must be the truth.**
Translating this quote into the field of statistics, there are two types of probabilities - - forward probability and inverse probability. Based on Sherlock Holmes's deductive reasoning, detective work is just finding the murderer with the highest inverse probability.
Learn this step by step with the interactive [AI and Data Scientist](https://roadmap.sh/ai-data-scientist) roadmap.
Going from forward probability to inverse probability, we are not only just flipping the variables sequentially but also enforcing a causal relationship. As briefly discussed in the previous article, Bayes's rule provides a bridge that connects objective data (evidence) with subjective opinions (prior belief). Based on Bayes's rule, we can calculate conditional probabilities from any two variables. For any variable A and B, given that B has happened, the probability of A happening is:
text

```
P(A|B) = P(A&amp;B)/P(B)
```

The belief that A happens will be updated based on the probability of B happening. The less likely B happens, P(B) gets smaller, the more belief I have for A to happen. Since P(B) is smaller or equal to 1, P(A|B) is always greater than or equal to P(A&B). This is saying that the belief a person attributes to A after discovering B is never lower than the degree of belief that a person attributes to A and B before discovering B. Note the conditional probability here applies to all variable relationships, even the non-causal ones. However, the inverse probability only applies to the causal relationship.
Assume the two events are _**Cause**_ and _**Evidence.**_ Forward probability represents the probability of _**Evidence**_ given the probability of _**Cause**_. Inverse probability, on the other hand, starts from the result and shows the probability of _**Cause**_ given the probability of _**Evidence**_. If we can identify the causal relationship between _**Cause**_ and _**Evidence**_ , then we can deduct the probability of Cause based on what we observe, which is more applicable in solving real-world problems.
In the book, Pearl gives an application in estimating what is the probability of having breast cancer given that the mammogram test comes out positive, i.e., what is **P(disease|test)**? First of all, there is a clear causal relationship where breast cancer is a cause, and the mammogram test results are the evidence. When we see a positive test result, it doesn't mean this patient has cancer for sure because no test is 100% accurate. However, we can deduct the probability of this patient having breast cancer based on the test quality, which is defined as the sensitivity of the test **P(test| disease)**. The test sensitivity is actually the forward probability, which is applicable to the general population.
In addition, individual-specific information can also improve our estimation of the inverse probability for each patient. For example, if this patient is from a family with several family members diagnosed with breast cancer, then a positive test result will be more trustworthy than a patient without family cancer history. This patient-specific information is added as a prior in the final formula that indicates how to update prior (the probability of having breast cancer) given the evidence (observing a positive test result):
text

```
Updated odds of D = Likelihood Ratio * Prior odds of D
```

In mathematical terms, it is:
Using both conditional probability and likelihood ratios, we can update beliefs in both directions. If we have new information from the cause, we can update our belief in evidence through conditional probability:
text

```
P(T| D) = P(T &amp; D)/P(D)
```

P(T| D) changes because of the changes in P(D). If we have new information from the evidence, conditional probability is not correct since testing positive does not make you have breast cancer. causal relationship is reversed. However, we could use the **likelihood ratio** of the evidence to update our belief.
So far, we have only discussed two causally connected variables, but this rule can be applied across a whole causal network, with the parent node indicating the cause and the child node showing the evidence. The child node will update its belief by applying conditional probability, and the parent node update its beliefs by multiplying the likelihood ratios. Applying these two rules in the whole network is called _**belief propagation**_. With these rules, we go beyond Bayes' rule to understand both how a cause affects the generation of evidence and how observing evidence helps us deduce causes.
* * *
## Confounders, the Achilles' heel in nonexperimental studies
Belief propagation helps us understand the interactions among variables if we can identify the causal relationship correctly. In the real world, going beyond two variables, we will need to expand the causal relationship to a causal diagram to derive causal impact systematically. But before we move toward the causal diagram, which is the core of this book, let's briefly discuss what has been preventing us from deriving causality from observational data, which are called confounders.
"Confounding" means "mixing" in English. It is the variable that is correlated with both X and Y. Note the correlation could be both causal and non-causal. Moreover, in the graph below, I didn't specify arrows between X&Z and Y&Z since, in the causal case, X, Y, and Z can all be either the cause or the result, establishing different causal diagrams that we will discuss in the next section. The left panel shows how having a confounder Z introduces a spurious correlation between X and Y.
In the right panel, if there is a causal relationship between X and Y, a confounder Z that affects both the cause X and the result Y will introduce confounding bias if not treating probably. We will not be able to disentangle the true causal effect of X on Y if we do not exclude the impact induced by confounders.
In experimental studies, the randomness in assigning subjects to treatment and control groups would resolve the confounder bias from the source (more to this in the last section). However, conducting experiments to study the causal effects is not always practical and ethical, in which cases, we will have no choice but to try deriving the true cause impact from observational data. Unlike experimental data, confounders exist in observational data because there are always factors that affect both the cause and the result.
For example, to study whether smoking causes lung cancer, one of the confounders is age. Different age groups have very different smoking rates, and the older, the higher chance of getting lung cancer. We will have to control age, and other confounders before getting the true causal impact. The common method statisticians and social scientists use to combat confounder bias is to "control" as many confounders as possible in their models. There are several issues with this method:
  * **Not all confounders are measurable:** Intuitively, we can figure out what might be confounders in a causal relationship we are interested in. However, it is not always possible to quantify these variables or find a suitable proxy to include them in the model. For example, when studying whether higher education causes higher income, one of the confounders can be "ambition." Ambitious people will be more likely to be motivated to get higher education and higher-paying jobs, but how can we quantify this subjective variable in observational studies?
  * **Omitted variables:** No matter how many variables we try to include in the studies, it is still very likely we do not include all the necessary and correct confounders or their proxies in our models, thus making the causal impact biased.
  * **Control confounders induce biases:** On the other hand, in practice, statisticians who, in order to make sure there are no confounders left behind, will include as many variables as possible in the model to ensure a debiased estimation. However, this _**overcontrolling**_ can actually cause biases instead. As written by a political blogger named [Ezra Klein](https://www.vox.com/2014/12/1/7311417/race-law-controls):


> "You see it all the time in studies. 'We controlled for...' And then the list starts. The longer the better, Income. Age. Race. Religion. Height. Hair color. Sexual preference. Crossfit attendance. Love of parents. Coke or Pepsi. The more things you can control for, the stronger your study is - - or, at least, the stronger your study seems. Controls give the feeling of specificity, of precision.... But sometimes, you can control for too much. Sometimes you end up controlling for the thing you are trying to measure."
Ultimately, when solving confounders bias, we face so many issues because it is a Rung 2 question that requires us to study causal relationships among variables. Thus, a Rung 1 solution that does not involve causal structures like drawing a causal diagram will not be enough. In the next section, we will see how utilizing causal diagrams can help us define confounders and control confounders in a systematic and trustworthy way.
* * *
## Establish causal diagrams, the keyholes to causality
### Three Basic Structures
To understand what is a causal diagram, we can start with the fundamental building blocks for all networks. There are three basic types of junctions that characterize any pattern of arrows in the network:
The three basic types exist both in the Bayesian network and causal diagram. Applying Bayes's rule across variables constructs a **Bayesian network** , which is nothing more than a compact representation of a huge probability table. If we see the chain structure A -> B -> C in a Bayesian network, the missing arrow between A and C means A and C are independent once we know the value of B. If the same chain structure is observed in a causal diagram, in addition to the same independence we will observe between A and C if we control B, we are also adding the causality flow through the arrow. This structure shows C is caused by B, B is caused by A, and A is external. If we change the structure to C -> B -> A, or to the fork structure A <- B -> C, we will see the exact same independence between A and C, holding B constant, but the causal structure has changed drastically. In other words, data can't tell us everything. No matter how large the data, we cannot distinguish **A - > B -> C**, **C - > B -> A**, and **A <- B -> C** without adding subjective causal assumptions.
Additionally, moving from the Bayesian network to a causal diagram, we are also transforming the Rung 1 probability thinking to Rung 2 and Rung 3 causal thinking. Instead of using the probabilistic expression "once we know the value of B," we can instead say "once we hold B constant," the same as moving from "seeing B'" to "intervening B." In the later section, we will see this difference comes from the **P(Y|X)** and **P(Y|**_**do**_**(X))**. Bayesian networks can only tell us how likely one event is, given that we observe another event. However, causal diagrams can answer interventional and counterfactual questions.
### The back-door criterion
Causal diagrams not only transform us into causal thinking but also equips us with a trustworthy tool to find and verify causal effect among observational data. As mentioned in the previous chapter, identifying the right confounders is the main challenge. To solve this issue, Pearl introduces the _**do-operator**_ and the _**back-door criterion**_.
The key is to figure out the causal diagrams, and the do-operator erases all the arrows that come into X, thus preventing any information about X from flowing in the noncausal direction. While P(Y| X) shows the causal effect with confounding bias, the probability P(Y| _do_(X)) shows the true causal impact. It means holding other confounders constant by blocking their information flows, how will Y change if I change X? Based on different causal structures, we need to control or not control different variables to block information flows.
In order to get P(Y| _do_(X)), we need to ensure the information flow from X to Y only comes directly from X to Y. In order to achieve this goal, we need to block every noncausal path between X and Y without perturbing any causal paths. These noncausal paths are called the back-door path to X, which is any path from X to Y that starts with an arrow pointing into X. It is easier to understand this concept with the five following examples:
By specifying the causal diagrams, we have transformed the process of controlling as many confounders as possible into identifying the backdoor paths and figuring out how to block them efficiently. As mentioned in the notes, it is not always the case to control as many variables as possible to ensure a true causal effect. In fact, controlling the wrong variables can:
  * Reduce or block the causal path between X and Y. For example, in Game 1, we will block the causal path between X and Y if we control for A, and partially block it if we control for B, the descendant of A.
  * Introduce collider bias for X and Y. For example, in Game 4, controlling B will make X and Y dependent when there is no causal relationship. Game 4 is also called the "M bias" because of it's shape.
  * Control the right confounder, not as many as possible. For example, in Game 5, we can choose to control B and A in the same time, or just control C to achieve the same result.


Each of the diagrams can be found with real world examples. For instance, in Game 1 represents a medical application that estimate the effect of smoking (X) on misscarriages (Y). A is an underlying abnormality that is induced by smoking, which is unobservable since we don't know which specific abnormality is induced through smoking. B is a history of previous miscarriages. It is very tempting to include miscarriage history into the model, but from the causal diagram, we can see if we do that, it will partial inactivating the mechanism through which smoking contributes to miscarriages, thus underestimate the true causal impact. There are a lot more real world applications in these two chapters in Pearl's book. Even though the causal diagram can get too complicated to have the human brains figuring out the backdoor paths, don't forget we will always have computer algorithms that are experts in cracking these types of problems.
### Why do randomized controlled trials(RCT) work?
We have enough discussion using causal diagrams for the non-experimental studies. How can we use the causal diagram and the backdoor criterior to explain why RCT works for deriving unbiased causal impact? Let's see an example where we try to figure out how does different fertillizer affect soil yield. In real world, farmer decide which fertilizer to use based on a lot of factors, like soil fertility, texture, which also affect yield. We can show it in a causal diagram:
All the orange lines shows the confounding relationships that bias the causal impact from fertilizer to yield. To fix that, we will need to control all these confounders in the model. Note it may not be possible because the "Other" factor here can be hard to name and quantify. However, if now we design a experiment that will decide which feritlizer to use for each plot purely on drawing random cards. Now the causal diagram becomes something like this:
By adding the random card to the diagram, we can remove all the confounding orange lines from the previous diagram because which fertilizer we use doesn't depend on any of these variables anymore. It is purely a randomized decision only affected by the random card draw. The backdoor critierion has met to estimate the causal impact of fertilizer and yield.
* * *
That's all I want to share from Chapter 3 and 4 of "The Book of Why" by Judea Pearl, which completes the third article in this "Read with Me" series. I hope this article is helpful to you. If you haven't read the first two articles, check them out here:
> [**Read with Me: A Causality Book Club**](https://towardsdatascience.com/read-with-me-a-causality-book-club-edd7085d6ae6)
> [**Data Tells Us "What" and We Always Seek for "Why"**](https://towardsdatascience.com/data-tells-us-what-and-we-always-seek-for-why-66da7dc3f24d)
If you are interested, [subscribe to my email list](https://zzhu17.medium.com/subscribe) to join the biweekly discussions that will become more and more technical:
  * [**Chapter5 &6:Why Understanding the Data-Generation Process Is More Important Than the Data Itself**](https://medium.com/towards-data-science/why-understanding-the-data-generation-process-is-more-important-than-the-data-itself-f1b3b847e662)
  * [**Chapter7 &8 You Can't Step in the Same River Twice**](https://medium.com/towards-data-science/you-cant-step-in-the-same-river-twice-cfacf7cee305)
  * [**Chapter9 &10 What Makes A Strong AI**](https://medium.com/towards-data-science/what-makes-a-strong-ai-012315722793)
  * [**Bonus: How is Causal Inference Difference in Academia and Industry?**](https://towardsdatascience.com/how-is-causal-inference-different-in-academia-and-industry-fb5afd12e2e7)


There are much more details and example that Pearl has shown in the book. As always, I highly encourage you to read, think and share what's your main takeaways either here or at your [own blog post](https://youtu.be/oFDl0-SKAL8?si=r1QiRIizhDBdvX-A).
Thanks for reading. If you like this article, don't forget to:
  * _**Check my recent articles about**_[ _**the 4Ds in data storytelling: making art out of science**_](https://medium.com/towards-data-science/the-4ds-in-data-storytelling-making-art-out-of-science-c4998ed7875e); _[**continuous learning in data science**](https://towardsdatascience.com/continuous-learning-a-data-scientists-odyssey-8d3006c2ce01?source=post_page-----ac6e01fe5cc3--------------------------------)**;**[**how I become a data scientist**](https://towardsdatascience.com/how-i-became-a-data-scientist-7f5b10606612?source=post_page-----ac6e01fe5cc3--------------------------------)**;** _
  * _**Check my**[**other articles**](https://zzhu17.medium.com/my-blog-posts-gallery-ac6e01fe5cc3)**on different topics like**[**data science interview preparation**](https://zzhu17.medium.com/list/data-science-interview-preparation-bfb0986a61a3)**;**[**causal inference**](https://towardsdatascience.com/causal-inference-what-why-and-how-d7336b0081ec?source=post_page-----ac6e01fe5cc3--------------------------------)**;** _
  * [_**Subscribe**_](https://zzhu17.medium.com/subscribe) _**to my email list;**_
  * [_**Sign up for medium membership**_](https://zzhu17.medium.com/membership) _**;**_
  * _**Or follow me on**_[ _**YouTube**_](https://youtube.com/channel/UCMs6go1pvY5OOy1DXVtMo5A) _**and watch my most recent YouTube video about other books I read:**_


Please accept cookies to access this content
Please accept cookies to access this content
## Reference
[_**The Book of Why**_](https://www.amazon.com/Book-Why-Science-Cause-Effect/dp/046509760X) _**by Judea Pearl**_
## Register Now to Continue Reading
### Unlock Towards Data Science with a Free Account
All articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.
Register for freeSign in to your account
* * *
![](../images/body-6091039d5533a6240825.png)
Written By
## [Zijing Zhu, PhD](https://towardsdatascience.com/author/zzhu17/)
[See all from Zijing Zhu, PhD](https://towardsdatascience.com/author/zzhu17/)
[Deep Dives](https://towardsdatascience.com/tag/deep-dives/)[Causal Diagrams](https://towardsdatascience.com/tag/causal-diagrams/)[Causal Inference](https://towardsdatascience.com/tag/causal-inference/)[Causality](https://towardsdatascience.com/tag/causality/)[Data Science](https://towardsdatascience.com/tag/data-science/)
Share This Article
  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fcausal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818%2F&title=Causal%20Diagram%3A%20Confronting%20the%20Achilles'%20Heel%20in%20Observational%20Data)
  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fcausal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818%2F&title=Causal%20Diagram%3A%20Confronting%20the%20Achilles'%20Heel%20in%20Observational%20Data)
  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fcausal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818%2F&text=Causal%20Diagram%3A%20Confronting%20the%20Achilles'%20Heel%20in%20Observational%20Data)


Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.
[Write for TDS](https://towardsdatascience.com/submissions/)
## Related Articles
  * [![](../images/001.jpeg)](https://towardsdatascience.com/quality-core-data-non-parametric-models-are-enabling-previously-impossible-data-projects-31aa3751b79f/)
## [Quality core data + non-parametric models are enabling previously impossible data projects](https://towardsdatascience.com/quality-core-data-non-parametric-models-are-enabling-previously-impossible-data-projects-31aa3751b79f/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
We built a machine model that predicted Super Bowl would have record low viewership but here's three things it had to learn to get there
[Dr. Xuxu Wang](https://towardsdatascience.com/author/xuxu_wang/)
February 23, 20218 min read
  * [![](../images/002.jpg)](https://towardsdatascience.com/transform-data-to-high-dimensional-kernel-space-87d62b670e0f/)
## [Transform Data to High-Dimensional Kernel Space](https://towardsdatascience.com/transform-data-to-high-dimensional-kernel-space-87d62b670e0f/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
An Introduction how to map data to kernel space using the Nystrom method.
[Laurenz Reitsam](https://towardsdatascience.com/author/laurenz.reitsam/)
July 31, 20206 min read
  * [![](../images/003.png)](https://towardsdatascience.com/bigquery-fetching-multiprocessing-dcb79de50108/)
## [BigQuery fetching + multiprocessing](https://towardsdatascience.com/bigquery-fetching-multiprocessing-dcb79de50108/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
Does multiprocessing improve the fetching speed of BigQuery API requests?
[Tristan Bilot](https://towardsdatascience.com/author/tristanbilot/)
October 6, 20213 min read
  * [![](../images/004.png)](https://towardsdatascience.com/build-a-multi-class-classification-neural-network-in-r-in-fifty-lines-of-code-88ba161297d3/)
## [Build a multi-class classification neural network in R in fifty lines of code](https://towardsdatascience.com/build-a-multi-class-classification-neural-network-in-r-in-fifty-lines-of-code-88ba161297d3/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
The R language allows us to rapidly prototype NN models. Here, I show you how you can build a neural network to predict on the iris...
[Theviyanthan Krishnamohan](https://towardsdatascience.com/author/thivi/)
June 11, 20215 min read
  * [![](../images/005.jpg)](https://towardsdatascience.com/building-ai-applications-in-ruby/)
## [Building AI Applications in Ruby](https://towardsdatascience.com/building-ai-applications-in-ruby/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
Why Ruby may be the best language to write your next AI web application
[Ed Izaguirre](https://towardsdatascience.com/author/ed.izaguirre/)
May 21, 202513 min read
  * [![](../images/006.png)](https://towardsdatascience.com/end-to-end-aws-rds-setup-with-bastion-host-using-terraform/)
## [End-to-End AWS RDS Setup with Bastion Host Using Terraform](https://towardsdatascience.com/end-to-end-aws-rds-setup-with-bastion-host-using-terraform/)
[Programming](https://towardsdatascience.com/category/programming/)
Learn how to automate secure AWS infrastructure using Terraform — including VPC, public/private subnets, a MySQL RDS database, and a Bastion host for secure access.
[Yagmur Gulec](https://towardsdatascience.com/author/yagmur.gulec/)
July 28, 202510 min read
  * [![](../images/007.png)](https://towardsdatascience.com/flamingo-intuitively-and-exhaustively-explained-bf745611238b/)
## [Flamingo - Intuitively and Exhaustively Explained](https://towardsdatascience.com/flamingo-intuitively-and-exhaustively-explained-bf745611238b/)
[ChatGPT](https://towardsdatascience.com/category/artificial-intelligence/chatgpt/)
The Architecture Behind Modern Visual Language Modeling
[Daniel Warfield](https://towardsdatascience.com/author/danielwarfield1/)
February 16, 202429 min read
  * [![](../images/008.jpg)](https://towardsdatascience.com/why-it-is-so-important-to-understand-the-missing-data-mechanisms-3d7d656ec7cc/)
## [Why It is So Important to Understand the Missing Data Mechanisms](https://towardsdatascience.com/why-it-is-so-important-to-understand-the-missing-data-mechanisms-3d7d656ec7cc/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
Missing Data Mechanisms with Easily Understandable Examples
[Ece Işık Polat](https://towardsdatascience.com/author/eceisikpolat/)
December 29, 20204 min read
  * [![](../images/009.png)](https://towardsdatascience.com/a-gentle-introduction-to-steerable-neural-networks-part-1-32323d95b03f/)
## [A gentle introduction to Steerable Neural Networks (part 1)](https://towardsdatascience.com/a-gentle-introduction-to-steerable-neural-networks-part-1-32323d95b03f/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
What are Steerable Neural Networks and context
[Matteo Ciprian](https://towardsdatascience.com/author/mat.cip43/)
November 21, 202316 min read


  * [YouTube](https://www.youtube.com/c/TowardsDataScience)
  * [X](https://x.com/TDataScience)
  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)
  * [Threads](https://www.threads.net/@towardsdatascience)
  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)


[](https://towardsdatascience.com/)
Your home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.
Subscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)
© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)
