![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
[Statistics](https://towardsdatascience.com/category/statistics/)
# Why Understanding the Data-Generation Process Is More Important Than the Data Itself
"The Book of Why" Chapters 5&6, a Read with Me series
[Zijing Zhu, PhD](https://towardsdatascience.com/author/zzhu17/)
December 7, 202316 min read
![Photo by Ryoji Iwata on Unsplash](../images/000.jpg)
Photo by [Ryoji Iwata](https://unsplash.com/@ryoji__iwata?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)
During the early stages of infancy, our brains already learn to associate correlation with causation and try to find an explanation for everything happening around us. If a car behind us takes the same turns we do for a long time, we assume it's following us, which is a causal assumption. However, when we snap out of the movie mood, we then think we are properly just heading to the same destination - - a confounder. A common cause introduces a correlation between the two cars' movements. This vivid and relatable example that Pearl gives proves how the human brain works.
What about the correlations that we couldn't fathom a reasonable explanation? Such as two diseases that are uncorrelated among the whole population but correlated among the hospitalized population. If you recall [my last article](https://medium.com/towards-data-science/causal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818) that discussed different causal structures, it points out that conditioning the colliders (hospitalized) generates an explain-away effect that makes two uncorrelated variables spuriously correlated. In other words, the hospitalized population is not an accurate representation of the general population, and any observations made from this sample cannot be generalized.
![Collider Bias, image by author based on &quot;The Book of Why&quot; Chapter 6](../images/001.png)
Collider Bias, image by author based on "The Book of Why" Chapter 6
Collider-induced correlations are not intuitive to human brains, thus generating these so-called paradoxes. In this article, I will explore more interesting paradoxes that create optical illusions in our brains like magic tricks but can be explained with causal diagrams. Understanding what's causing these paradoxes is meaningful and educational. It is the 4th article for the "Read with Me" series, and it's based on Chapters 5 and 6 from "[The Book of Why](https://www.amazon.com/Book-Why-Science-Cause-Effect/dp/046509760X)" by Judea Pearl. This should be a fun read based on all the examples Pearl gives in these two chapters! You can find the previous article here:
  * [**Kick-off: Start with A Cat Story**](https://medium.com/towards-data-science/read-with-me-a-causality-book-club-edd7085d6ae6)
  * [**Chapter1 &2: Data Tells Us 'What" and We Always Seek for "Why**](https://medium.com/towards-data-science/data-tells-us-what-and-we-always-seek-for-why-66da7dc3f24d)
  * [**Chapter3 &4: Causal Diagram: Confronting the Achilles' Heel in Observational Data**](https://medium.com/towards-data-science/causal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818)


* * *
![Photo by Glenn Carstens-Peters on Unsplash](../images/002.jpg)
Photo by [Glenn Carstens-Peters](https://unsplash.com/@glenncarstenspeters?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)
### Let's make a Deal
The American television show "Let's Make a Deal" features a famous statistical problem known as the "Monty Hall Problem," named after the show's host, Monty Hall. In this game, a participant is facing three doors, behind one of which is a highly sought-after prize such as a car, and behind the other two are less desirable prizes, often humorously referred to as goats. The rules are:
  * Step 1: The participant chooses one of the three doors as an initial selection, say door 1;
  * Step 2: The host, who knows what is behind each door, opens one of the other two doors to reveal the goat, say door 3;
  * Step 3: The participant has the option to stick with their original choice or switch to the remaining unopened door, i.e., the participant can stay with door 1 or choose door 2 instead.


The best strategy for winning the car is always to switch after the host reveals a goat behind one of the other doors. If you want to see the detailed calculation, you can find it in Question 9 of this article using Bayesian statistics.
> [**12 Probability Practice Questions for Data Science Interviews**](https://towardsdatascience.com/12-probability-practice-questions-for-data-science-interviews-2ec5230304d9)
Or, you can refer to the following table that shows three scenarios and the outcomes of switching or not switching, given the participant has chosen door 1. For first row shows that the car is in door 1, and the host can open either door 2 or door 3 to reveal the goat. If the participant switches, they will lose. In row 2, the host has to reveal door 3 for the goat, and similarly, the host can only open door 2 for the goat. Since the participants are equally likely to choose any door as the initial selection, comparing the columns of "Switch" and "Not Switch," we can see switch door has a higher probability of winning at 2/3 compared to not switching at 1/3. Thus, switching doors is a preferred strategy.
![Table by author based on &quot;The Book of Why&quot; Chapter 6](../images/003.png)
Table by author based on "The Book of Why" Chapter 6
This may seem counterintuitive since it implies the show producer somehow read the participants' minds about their initial selection. The switching strategy is preferred compared to not switching, indicating the participants' initial choice is correlated with the location of the car, while intuitively speaking, these two variables should be independent of each other. What's the explanation here? We can solve this paradox through this causal diagram:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/004.png)
Image by author based on "The Book of Why" Chapter 6
This causal diagram shows _**collider bias**_. Step 2 of the show rule indicates that based on the car's location and the participant's first choice, the host will only choose to open the goat door. This rule actually **adds information**. The fact that the host opened door 3 instead of door 2 makes door 2 more likely to have a car behind. Conditioning on the collider, in this case, given that the host opened door 3, the participants' first choice, door 1, is less likely to be the car location since switching is a better strategy.
What if we change the game rule that in Step 2, the host can open any door even if it has the car behind it? The corresponding outcome for participants who chose door 1 initially are presented in the following table with all possible scenarios:
![Table by author based on &quot;The Book of Why&quot; Chapter 6](../images/005.png)
Table by author based on "The Book of Why" Chapter 6
Now, if we calculate the chances of winning from switching or not switching based on the outcomes in the last two columns, we can see that there is no difference. The winning probability for both strategies is at 1/3. Combining with the causal diagram:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/006.png)
Image by author based on "The Book of Why" Chapter 6
Modifying the rule in Step 2 removes the causal relationship between the door opened by the host and the car location. Thus, the spurious correlation between the participant's initial selection and where the show producer put the car has disappeared.
In this case, modifying the **data generation process** (the rules) points to different strategies even with the same **data** (the door the host opens).
* * *
### Revisit Simpson's Paradox
Simpson's Paradox is also a well-known confusion widely discussed by statisticians. When we observe different relationships between two variables in the population and subpopulation, which result should we trust? For example, if a medicine is found harmful for the male group and female group separately, but beneficial for the whole population, should we still approve the medicine?
![Photo by Brendan Church on Unsplash](../images/007.jpg)
Photo by [Brendan Church](https://unsplash.com/@bdchu614?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)
Pearl argues
> the confusion over Simpson's paradox is a result of **incorrect application of causal principles to statistical proportions**.
By using causal diagrams to illustrate different data generation processes, even when working with the same data, we can arrive at vastly different conclusions. Let's examine an example of a drug designed to reduce the risk of heart attack.
### **Scenario #1: Trust the subgroups**
The table below compares heart attack rates between treatment and control groups for two gender subpopulations and the whole population with synthetic data. Note the study is not randomized.
![Table by author based on &quot;The Book of Why&quot; Chapter 6](../images/008.png)
Table by author based on "The Book of Why" Chapter 6
By comparing heart attack rates, we can see the drug harms the female and male subgroups but is helpful for the pooled. Which result should we trust? To answer this question, we need to use the following causal diagram:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/009.png)
Image by author based on "The Book of Why" Chapter 6
The diagram shows gender as a confounder for drug and heart attack that will bias the causal relationship without conditioning on it. In other words, in the "Total" row, the 22% and 18% show the biased estimations.
To calculate what is the drug's impact on the overall population, we need to estimate the drug's impacts on different gender groups and then take a weighted average.
Using the data above, we know in the control group, the female and male heart attack rate is 5% and 30%. Assuming females and males are equally frequent in the general population, the control group's heart attack rate is (5%+30%)*0.5 = 17.5%.
Similarly, we can get the treatment group's heart attack rate is (8%+40%)*0.5 = 24%. Overall, it is still higher than the control group, which is consistent with what we found in the subgroups. Thus, this medicine should not be approved.
### Scenario #2: Trust the aggregation
Now, let's move to another scenario with the same data. The only difference is that instead of separating by gender, we separated it by the patient's blood pressure levels.
![Table by author based on &quot;The Book of Why&quot; Chapter 6](../images/010.png)
Table by author based on "The Book of Why" Chapter 6
Here, the data reveals the same contradictions between the separated and aggregated groups. However, the different causal diagram changes our conclusion. The idea is that the drug is designed to reduce the heart attack risk by reducing a patient's blood pressure:
![Image by author based on &quot;The Book of Why&quot; Chapter 6r](../images/011.png)
Image by author based on "The Book of Why" Chapter 6r
The causal diagram shows blood pressure as a mediator instead of a confounder. Recall what we discussed in [the last article](https://medium.com/towards-data-science/causal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818): controlling the mediator or the proxy of the mediator will block the causal impact completely or partially.
Thus, pooling the data would be appropriate. We can conclude that the drug is beneficial as it reduces heart attack risk from 22% to 18% in the treatment group compared to the control group.
* * *
### Simpson's Paradox in Continuous Variables
Now, we have seen the importance of examining beyond data to look at the data-generation process when deciding whether to aggregate or separate by groups. Let's see an example that applies the same concept in continuous variables.
The paradox was first presented by Frederic Lord in 1967 when studying the effects of the diet provided by different dining halls, specifically, how the diet affects girls and boys differently.
The student's weight is measured in September as the initial weight and again in the following June to calculate the weight gained. The result is shown in the following graph:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/012.png)
Image by author based on "The Book of Why" Chapter 6
The two ellipses represent the scatter plots of initial weight and final weight for girls and boys. The graph itself shows contradicting conclusions in terms of the diet's impact on girls and boys:
  * If we focus on the 45-degree line where W_f =W_i, we can see that, on average, the diet has no impact on both girls and boys because the weight distribution is symmetric at W_f =W_i;
  * If we argue that initial weight is influential to the final weight and focus on each initial weight observation, such as W0, we can see that the vertical line intersects the boys' ellipse higher up than the girls'. In other words, on average, boys starting with weight W0 will reach a greater final weight than girls starting with the same initial weight.


The graph shows that boys gain more weight than girls starting with every initial weight. Yet it's equally obvious that both boys and girls gained nothing at all. These two conclusions give different guidance to school dietitians. Which decision should they make? That's when the following causal diagram comes in handy:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/013.png)
Image by author based on "The Book of Why" Chapter 6
When studying whether sex has impacted weight gain, the causal diagram shows there is no backdoor path. So, the observed, aggregated data provide the accurate conclusion that the diet has no impact on both girls and boys. If we control initial weight, we will control a mediator that actually blocks part of the causal impact from sex to weight gain through initial weight.
This conclusion also proves that the overall gain is not always the average of stratum-specific gains (**sure-thing principle**). If the number of girls and boys is the same for each strata, i.e., each initial weight, then what we observed at each initial weight can be generalized to the whole population. It is clearly not the case here since the distributions of girls and boys are different at each initial weight.
What if we put different narratives in the same data? Instead of observing how sex impact weight gain, we can serve different diet at different dining halls and compare the weight gain for students eating in different dining halls. The graph now becomes:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/014.png)
Image by author based on "The Book of Why" Chapter 6
We can see that students who go to dining hall B have higher initial weights. The same contradicting conclusion can be drawn since the data is the same. However, the causal diagram has changed:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/015.png)
Image by author based on "The Book of Why" Chapter 6
Now, there is a backdoor path to diet and weight gain. Initial weight has become a confounder that will bias the causal relationship between diet and weight gain if we fail to control it.
Thus, we should go with the conclusion that takes initial weights into consideration. From the graph, we can see on average, students going to dining hall B gained more weight than students going to dining hall A.
From all these examples above, we can see that Simpson's Paradox is not just a reversal that we find in real-world data sets all the time. By reversal, I mean if we observe A/B > a/b, and C/D > c/d, it is not guaranteed that (A+C)/(B+D) > (a+c)/(b+d). It is merely rules in arithmetic inequality.
However, Simpson's Paradox is beyond mathematic calculation. It is necessary to thoroughly analyze the causal model to comprehend the data-generating process rather than solely relying on the observed data when facing contradictory conclusions.
* * *
### The long debate between smoking and lung cancer
Besides providing real-life examples in Chapter 6 to illustrate the importance of understanding the data-generation process, Pearl also explores and focuses on the causal relationship between smoking and lung cancer in Chapter 5 to prove the point.
![Photo by Volodymyr Hryshchenko on Unsplash](../images/body-709197ba5648be8e7a52.jpg)
Photo by [Volodymyr Hryshchenko](https://unsplash.com/@lunarts?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)
From the lengthy debate on whether smoking is a causal factor, we can infer how the theory developed and causality was brought to the front stage over time.
The studies on whether smoking causes lung cancer are challenging due to at least these three factors:
  * It is unethical to run RCT that forces participants to smoke and expose them to potential harm to health;
  * Observational data are likely to have confounders since the distribution of the treatment group can be fundamentally different from the control group.
  * The potential obstacles and deliberate efforts the tobacco companies can put to deceive the public about the health risks.


In the past decades, statisticians have had multiple trials to find the correct methodology, even facing these obstacles.
### A case-control study
As Pearl summarizes in his book, it began with a case-control study that compared individuals with lung cancer to a control group of healthy volunteers. The study then determined whether the "cases" in the treatment group had more smokers than in the control group, taking into consideration some confounders like age, sex, and exposure to environmental pollutants.
However, this study faced several drawbacks:
  * **A backward logic** : instead of answering what is the probability that a smoker can get cancer, it is showing what is the probability that a cancer patient is a smoker;
  * **Recall bias** : Even though the researcher made sure not to let the patients know about their diagnosis prior to the survey, they can probably infer it based on their own health condition;
  * **Selection bias** : The study is only focused on hospitalized cancer patients, which is not a good representation of the whole population or even the smoking population.


### Cornfield's inequality
The debate continues when questions arise regarding whether smokers are "self-selecting" that they are genetically different from nonsmokers. Some concerns Pearl mentions in his book are"
> They are more risk-taking or more likely to develop addictive behaviors that actually cause adverse health effects.
In other words, the debate goes to which of the following causal diagrams is correct. Is the "smoking gene" the only reason we observe relationships between "smoking" and "lung cancer"?
![Image by author based on &quot;The Book of Why&quot; Chapter 5](../images/body-9aafaaddc1d1d2c258df.png)
Image by author based on "The Book of Why" Chapter 5
Cornfield challenged the left causal diagram using simple math. If the left causal diagram is true and in the data, we observe smokers are **nine times** more likely to develop lung cancer, it must be because they are **nine times** more likely to have the smoking gene than non-smokers.
As illustrated in Pearl's book referring to Cornfield' argument:
> If 11% of non-smokers have the smoking gene, then 99% of the smokers would have to have it. However, the percentage becomes mathematically impossible if we observe that 12% of non-smokers have the smoking gene.
In this case, the smoking gene cannot account fully for the relationship between smoking and lung cancer. Thus, the right causal diagram provides a more accurate explanation.
Naming after its proposer, this argument is called Cornfield's inequality, which sheds light on drawing inferences by evaluating how strong alternative relationships must be in the absence of causality to explain the observed data.
### The birth-weight paradox
I hope we have already established a foundation well enough to claim that data is not enough to understand causality and explain real-world scenarios that present as paradoxes.
Another example that Pearl gives in his book is a study that focused on finding how mothers who smoke affect their babies' survival rates, challenging the argument that smoke causes mortality. The findings show that babies of smoking mothers indeed weigh less. However, the low-birth-weight babies of smoking mothers had a better survival rate than those of non-smokers.
The finding might look counterintuitive that smoking reduces birth weight and reduces child mortality rate. However, if we think further about what are the factors that contribute to babies' birth weights other than smoking, we will find the collider bias here.
For example, other life-threatening genetic abnormalities might also explain the lower birth rate. We can see it more clearly by drawing the causal diagram:
![Image by author based on &quot;The Book of Why&quot; Chapter 5](../images/body-fcdeab7c6e89b5da52ba.png)
Image by author based on "The Book of Why" Chapter 5
Here, "smoking -> birth weight <- birth defect" forms a collider structure. Smoking has no correlation with birth defects unless we control birth weight. If we only look at low-birth-weight babies, we are opening up the backdoor path of smoking to mortality. The relationship will be biased by the birth defects to mortality causal path.
Indeed, other factors can add to the causal diagram that will point to birth weight. For example, studies have found _**race**_ is another factor that affects both birth weight and child mortality.
The list can continue, only one thing we need to keep in mind in terms of what's the **action point** taken from the causal diagram. As Pearl puts in his book:
> We can use this diagram and data to persuade a pregnant woman to stop smoking. But we can't tell a pregnant black woman to stop being black.
* * *
### Last remarks
Collider bias is everywhere. Have you noticed from your friends' experience that among all the people they date, the attractive ones tend to be jerks? Instead of utilizing psychosocial theories involving traumas and personality disorders, Pearl shows that **collider bias** can be the answer. Your friends' choices of people to date depend on two factors: attractiveness and personality. In this case, you will date a mean, attractive person, a nice, unattractive person, and certainly a nice, attractive person. However, you will never date a mean, unattractive person. As illustrated by the following causal diagram:
![Image by author based on &quot;The Book of Why&quot; Chapter 6](../images/body-73ce6306f60e49f70eb1.png)
Image by author based on "The Book of Why" Chapter 6
By only looking at your friend's dating pool, you are controlling a collider that will create a spurious negative correlation between attractiveness and personality.
Just as Pearl says, even though the sad fact is that unattractive people are as mean as attractive people in the whole population (Attractiveness and Personality are not correlated), your friends never realize it because the dating pool never has somebody who is mean and unattractive.
This concludes this article full of fun facts and explanations of paradoxes using causal diagrams. Paradoxes are data we observe that trick and confuse us. However, by digging into the data generation process and drawing the causal diagrams, we can provide explanations of these paradoxes, which not only clears the confusion but also gives us trustworthy guidance into decision-making.
* * *
That's all I want to share from Chapters 5 and 6 of "The Book of Why" by Judea Pearl, which completes the 4th article in this "Read with Me" series. I hope this article is helpful to you. If you haven't read the first three 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)
> [**Causal Diagram: Confronting the Achilles' Heel in Observational Data**](https://towardsdatascience.com/causal-diagram-confronting-the-achilles-heel-in-observational-data-a69cdb1c4818)
> [**You Can't Step in the Same River Twice**](https://towardsdatascience.com/you-cant-step-in-the-same-river-twice-cfacf7cee305)
> [**What Makes A Strong AI?**](https://towardsdatascience.com/what-makes-a-strong-ai-012315722793)
> [**How is Causal Inference Different in Academia and Industry?**](https://towardsdatascience.com/how-is-causal-inference-different-in-academia-and-industry-fb5afd12e2e7)
If interested, [subscribe to my email list](https://zzhu17.medium.com/subscribe) to join the currently ongoing biweekly discussions. As always, I highly encourage you to read, think, and share your main takeaways here or on [your own blog](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 Data Science](https://towardsdatascience.com/tag/causal-data-science/)[Causal Inference](https://towardsdatascience.com/tag/causal-inference/)[Causality](https://towardsdatascience.com/tag/causality/)[Statistics](https://towardsdatascience.com/tag/statistics/)
Share This Article
  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fwhy-understanding-the-data-generation-process-is-more-important-than-the-data-itself-f1b3b847e662%2F&title=Why%20Understanding%20the%20Data-Generation%20Process%20Is%20More%20Important%20Than%20the%20Data%20Itself)
  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fwhy-understanding-the-data-generation-process-is-more-important-than-the-data-itself-f1b3b847e662%2F&title=Why%20Understanding%20the%20Data-Generation%20Process%20Is%20More%20Important%20Than%20the%20Data%20Itself)
  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fwhy-understanding-the-data-generation-process-is-more-important-than-the-data-itself-f1b3b847e662%2F&text=Why%20Understanding%20the%20Data-Generation%20Process%20Is%20More%20Important%20Than%20the%20Data%20Itself)


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/016.jpeg)](https://towardsdatascience.com/22-statistics-questions-to-prepare-for-data-science-interviews-d5651a8b3c56/)
## [22 Statistics Questions to Prepare for Data Science Interviews](https://towardsdatascience.com/22-statistics-questions-to-prepare-for-data-science-interviews-d5651a8b3c56/)
[Data Science](https://towardsdatascience.com/category/data-science/)
Nail data science interviews with confidence, part 2
[Zijing Zhu, PhD](https://towardsdatascience.com/author/zzhu17/)
October 21, 202010 min read
  * [![](../images/017.png)](https://towardsdatascience.com/the-art-of-the-phillips-curve/)
## [The Art of the Phillips Curve](https://towardsdatascience.com/the-art-of-the-phillips-curve/)
[Economics](https://towardsdatascience.com/category/society/economics/)
The subjective details holding together one of economics’ favourite models
[Cai Parry-Jones](https://towardsdatascience.com/author/caiparryjones96/)
May 12, 202515 min read
  * [![](../images/018.jpeg)](https://towardsdatascience.com/famous-italian-solitaire-simulation-and-statistics-using-python-b10d60b34fc6/)
## [Famous Italian solitaire simulation and statistics using Python](https://towardsdatascience.com/famous-italian-solitaire-simulation-and-statistics-using-python-b10d60b34fc6/)
[Data Science](https://towardsdatascience.com/category/data-science/)
Implementing a solitaire simulator and extracting the winning probabilities out of it, with few lines of (Python) codes
[Piero Paialunga](https://towardsdatascience.com/author/piero-paialunga/)
January 24, 20215 min read
  * [![](../images/019.jpg)](https://towardsdatascience.com/poisson-distribution-and-poisson-process-in-python-statistics-a7aa573c03f4/)
## [Poisson Distribution and Poisson Process in Python - Statistics](https://towardsdatascience.com/poisson-distribution-and-poisson-process-in-python-statistics-a7aa573c03f4/)
[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)
In this article we will explore Poisson distribution and Poisson process in Python.
[Misha Sv](https://towardsdatascience.com/author/pyshark/)
November 23, 20217 min read
  * [![](../images/020.jpeg)](https://towardsdatascience.com/partial-correlation-508353cd8b5/)
## [Partial correlation-the idea and significance](https://towardsdatascience.com/partial-correlation-508353cd8b5/)
[Statistics](https://towardsdatascience.com/category/statistics/)
Is the correlation between two variables reliable?
[Xichu Zhang](https://towardsdatascience.com/author/xichu.zhang/)
August 14, 20216 min read
  * [![](../images/021.jpeg)](https://towardsdatascience.com/histograms-and-density-plots-in-python-f6bda88f5ac0/)
## [Histograms and Density Plots in Python](https://towardsdatascience.com/histograms-and-density-plots-in-python-f6bda88f5ac0/)
[Programming](https://towardsdatascience.com/category/programming/)
Visualizing One-Dimensional Data in Python Plotting a single variable seems like it should be easy....
[Will Koehrsen](https://towardsdatascience.com/author/will%20koehrsen/)
March 23, 201811 min read
  * [![](../images/022.jpg)](https://towardsdatascience.com/where-hurricanes-hit-hardest-a-county-level-analysis-with-python/)
## [Where Hurricanes Hit Hardest: A County-Level Analysis with Python](https://towardsdatascience.com/where-hurricanes-hit-hardest-a-county-level-analysis-with-python/)
[Data Science](https://towardsdatascience.com/category/data-science/)
From storm tracks to insurance risk
[Lee Vaughan](https://towardsdatascience.com/author/lee_vaughan/)
August 21, 202514 min read
  * [![](../images/023.png)](https://towardsdatascience.com/logic-and-implementation-of-a-spam-filter-machine-learning-algorithm-a508fb9547bd/)
## [Logic and implementation of a spam filter machine learning algorithm](https://towardsdatascience.com/logic-and-implementation-of-a-spam-filter-machine-learning-algorithm-a508fb9547bd/)
[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)
A beginner's guide to spam classification
[Lily Chen](https://towardsdatascience.com/author/lilychencodes/)
December 7, 20208 min read
  * [![](../images/024.jpeg)](https://towardsdatascience.com/probability-learning-ii-how-bayes-theorem-is-applied-in-machine-learning-bd747a960962/)
## [Probability Learning II: How Bayes' Theorem is applied in Machine Learning](https://towardsdatascience.com/probability-learning-ii-how-bayes-theorem-is-applied-in-machine-learning-bd747a960962/)
[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)
Learn how Bayes Theorem is in Machine Learning for classification and regression!
[James Thorn](https://towardsdatascience.com/author/james-thorn/)
August 14, 20199 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)
####  Recommended Articles 
Close
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ "How Relevance Models Foreshadowed Transformers for NLP")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ "Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ "The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs")
  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ "Does Your Company Have a Data Strategy?")


