<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Data Analysis on kenji.blog</title><link>http://kenji.blog/en/tags/data-analysis/</link><description>Recent content in Data Analysis on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>kenjinote</copyright><lastBuildDate>Thu, 10 Sep 2026 07:00:00 +0900</lastBuildDate><atom:link href="http://kenji.blog/en/tags/data-analysis/index.xml" rel="self" type="application/rss+xml"/><item><title>Simpson's Paradox: The Mysterious Phenomenon of Winning in the Parts but Losing in the Whole</title><link>http://kenji.blog/en/p/simpsons-paradox/</link><pubDate>Thu, 10 Sep 2026 07:00:00 +0900</pubDate><guid>http://kenji.blog/en/p/simpsons-paradox/</guid><description>&lt;img src="http://kenji.blog/p/simpsons-paradox/img/simpsons_paradox.jpg" alt="Featured image of post Simpson's Paradox: The Mysterious Phenomenon of Winning in the Parts but Losing in the Whole" />&lt;h2 id="1-which-hospital-should-you-get-surgery-at">1. Which hospital should you get surgery at?
&lt;/h2>&lt;p>You have fallen seriously ill and must undergo surgery.
Before you, there are two choices: Hospital A and Hospital B. You requested the &amp;ldquo;success rate&amp;rdquo; data for surgeries at each hospital.&lt;/p>
&lt;p>&lt;strong>[Overall Success Rate]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A&lt;/strong>: 900 out of 1000 people succeeded (Success rate &lt;strong>90%&lt;/strong>)&lt;/li>
&lt;li>&lt;strong>Hospital B&lt;/strong>: 800 out of 1000 people succeeded (Success rate &lt;strong>80%&lt;/strong>)&lt;/li>
&lt;/ul>
&lt;p>Looking at this, anyone would think &amp;ldquo;Hospital A is better!&amp;rdquo;
However, since you have a cautious personality, you decided to investigate in more detail how the data changes depending on the state of the disease (mild or severe).&lt;/p>
&lt;p>&lt;strong>[Success Rate for Mild Patients]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A&lt;/strong>: 99 out of 100 people succeeded (Success rate &lt;strong>99%&lt;/strong>)&lt;/li>
&lt;li>&lt;strong>Hospital B&lt;/strong>: 870 out of 900 people succeeded (Success rate &lt;strong>96%&lt;/strong>)
$\rightarrow$ For mild cases, &lt;strong>Hospital A wins (99% &amp;gt; 96%)&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>[Success Rate for Severe Patients]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A&lt;/strong>: 801 out of 900 people succeeded (Success rate &lt;strong>89%&lt;/strong>)&lt;/li>
&lt;li>&lt;strong>Hospital B&lt;/strong>: 70 out of 100 people succeeded (Success rate &lt;strong>70%&lt;/strong>)
$\rightarrow$ Even for severe cases, &lt;strong>Hospital A wins (89% &amp;gt; 70%)&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>Wait? Don&amp;rsquo;t you think something is strange?&lt;/p>
&lt;p>For &amp;ldquo;mild&amp;rdquo; patients, Hospital A has a higher success rate.
For &amp;ldquo;severe&amp;rdquo; patients, Hospital A has a higher success rate.
And yet, when you calculate the &amp;ldquo;overall&amp;rdquo; success rate for all patients combined&amp;hellip;?&lt;/p>
&lt;ul>
&lt;li>Hospital A Overall: $(99 + 801) / 1000 =$ &lt;strong>90%&lt;/strong>&lt;/li>
&lt;li>Hospital B Overall: $(870 + 70) / 1000 =$ &lt;strong>94%&lt;/strong>&amp;hellip; Wait, according to the previous calculation, wasn&amp;rsquo;t it &lt;strong>80%?&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>Wait a minute, let&amp;rsquo;s look at the first data again.
The first data was like this.&lt;/p>
&lt;ul>
&lt;li>Hospital A Overall Success Rate: &lt;strong>90%&lt;/strong>&lt;/li>
&lt;li>Hospital B Overall Success Rate: &lt;strong>80%&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>However, if we recalculate using the broken-down data,
Hospital B&amp;rsquo;s overall success rate should be $(870 + 70) / 1000 = 940 / 1000 = $ &lt;strong>94%&lt;/strong>.&lt;/p>
&lt;p>&lt;strong>&amp;hellip;Well, you&amp;rsquo;ve been fooled!&lt;/strong>
Actually, this trick of numbers is exactly the terrifying trap of statistics that we will explain this time.
Let me show you the correct data once more.&lt;/p>
&lt;hr>
&lt;h2 id="2-to-you-who-were-fooled-the-real-data">2. To you who were fooled: The real data
&lt;/h2>&lt;p>&lt;strong>[Success Rate for Mild Patients]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A&lt;/strong>: 870 out of 900 people succeeded (Success rate &lt;strong>96%&lt;/strong>)&lt;/li>
&lt;li>&lt;strong>Hospital B&lt;/strong>: 99 out of 100 people succeeded (Success rate &lt;strong>99%&lt;/strong>)
$\rightarrow$ For mild cases, &lt;strong>Hospital B wins (99% &amp;gt; 96%)&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>[Success Rate for Severe Patients]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A&lt;/strong>: 30 out of 100 people succeeded (Success rate &lt;strong>30%&lt;/strong>)&lt;/li>
&lt;li>&lt;strong>Hospital B&lt;/strong>: 315 out of 900 people succeeded (Success rate &lt;strong>35%&lt;/strong>)
$\rightarrow$ Even for severe cases, &lt;strong>Hospital B wins (35% &amp;gt; 30%)&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>In other words, whether mild or severe, &lt;strong>Hospital B is overwhelmingly superior&lt;/strong>.&lt;/p>
&lt;p>Now, let&amp;rsquo;s combine this into an &amp;ldquo;overall&amp;rdquo; figure.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hospital A Overall&lt;/strong>: $(870 + 30) / (900 + 100) = 900 / 1000 =$ &lt;strong>Success rate 90%&lt;/strong>&lt;/li>
&lt;li>&lt;strong>Hospital B Overall&lt;/strong>: $(99 + 315) / (100 + 900) = 414 / 1000 =$ &lt;strong>Success rate 41%&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>Surprisingly, even though Hospital B wins in everything when looking at the &amp;ldquo;parts&amp;rdquo;, Hospital A overwhelmingly wins when combining into the &amp;ldquo;whole&amp;rdquo;!
This is the phenomenon known as &lt;strong>&amp;ldquo;Simpson&amp;rsquo;s Paradox&amp;rdquo;&lt;/strong>.&lt;/p>
&lt;div class="mermaid">graph TD
subgraph "Partial data (B wins)"
Light["Mild: Hospital B wins (99% > 96%)"]
Heavy["Severe: Hospital B wins (35% > 30%)"]
end
subgraph "Overall data (A wins)"
Total["Overall sum: Hospital A overwhelmingly wins (90% > 41%)"]
end
Light -->|Summing them up somehow reverses the result| Total
Heavy -->|Summing them up somehow reverses the result| Total
style Total fill:#ff9999,stroke:#333,stroke-width:2px&lt;/div>
&lt;hr>
&lt;h2 id="3-why-does-this-bizarre-reversal-occur">3. Why does this bizarre reversal occur?
&lt;/h2>&lt;p>The true nature of this paradox lies in &lt;strong>&amp;ldquo;bias in the denominator (population size)&amp;rdquo;&lt;/strong> and &lt;strong>&amp;ldquo;hidden variables (confounding factors)&amp;rdquo;&lt;/strong>.&lt;/p>
&lt;p>Look closely at the data.&lt;/p>
&lt;ul>
&lt;li>Hospital A accepts &lt;strong>a massive number of &amp;ldquo;mild patients who are easy to cure&amp;rdquo; (900 people)&lt;/strong>.&lt;/li>
&lt;li>Hospital B accepts &lt;strong>a massive number of &amp;ldquo;severe patients who are difficult to cure&amp;rdquo; (900 people)&lt;/strong>.&lt;/li>
&lt;/ul>
&lt;p>Because Hospital B has highly skilled doctors, it was like a &amp;ldquo;last resort&amp;rdquo; hospital taking in many difficult severe patients turned away by others. Naturally, the success rate for severe patients is lower (35%). Hospital B&amp;rsquo;s &amp;ldquo;overall success rate&amp;rdquo; was dragged down by the low success rate of this massive number of severe patients, making it appear lower overall (41%).&lt;/p>
&lt;p>Conversely, since Hospital A handles mostly simple mild patients, its overall success rate appeared high (90%), but when compared under the same conditions (severe vs. severe, mild vs. mild), its skills were inferior to Hospital B.&lt;/p>
&lt;p>Expressed in mathematical formulas, the cause is the property of adding fractions.
In general, even if $\frac{a}{b} &lt; \frac{A}{B}$ and $\frac{c}{d} &lt; \frac{C}{D}$,
&lt;/p>
$$ \frac{a+c}{b+d} &lt; \frac{A+C}{B+D} $$
&lt;p>
does not always hold true. When the sizes of the denominators are extremely different, the direction of the inequality sign can reverse.&lt;/p>
&lt;hr>
&lt;h2 id="4-simpsons-paradox-occurring-in-the-real-world">4. &amp;ldquo;Simpson&amp;rsquo;s Paradox&amp;rdquo; occurring in the real world
&lt;/h2>&lt;p>This paradox is not merely an arithmetic puzzle; it frequently occurs in real society and has sparked major controversies.&lt;/p>
&lt;h3 id="the-1973-uc-berkeley-gender-bias-suspicions">The 1973 UC Berkeley Gender Bias Suspicions
&lt;/h3>&lt;p>When investigating the admission rates for graduate school at UC Berkeley, the &amp;ldquo;male admission rate (44%)&amp;rdquo; was significantly higher than the &amp;ldquo;female admission rate (35%)&amp;rdquo;, which became an issue as apparent discrimination against women.
However, when the data was broken down and analyzed &amp;ldquo;by department&amp;rdquo;, an astonishing fact came to light.
In almost all departments, &lt;strong>the admission rate for women was higher than for men&lt;/strong>.&lt;/p>
&lt;p>Why did the overall numbers reverse?
Actually, women applied in large numbers to &amp;ldquo;departments with low admission rates (highly competitive)&amp;rdquo;, while men applied in large numbers to &amp;ldquo;departments with high admission rates (easier to get into)&amp;rdquo;.&lt;/p>
&lt;h3 id="efficacy-data-of-covid-19-vaccines">Efficacy Data of COVID-19 Vaccines
&lt;/h3>&lt;p>There was a time when data circulated stating &amp;ldquo;people who received the vaccine have a higher mortality rate than those unvaccinated&amp;rdquo;, which caused an uproar.
This was also the result of ignoring data by age group (a hidden variable).
Because the vaccine was prioritized for &amp;ldquo;the elderly (who inherently have a higher mortality rate)&amp;rdquo;, simply summing up the overall mortality rate caused an extreme skew of elderly people in the vaccinated group, making the mortality rate appear artificially higher.&lt;/p>
&lt;p>When comparing by age group, it was confirmed that &amp;ldquo;people who received the vaccine had a lower mortality rate&amp;rdquo; in all age groups.&lt;/p>
&lt;hr>
&lt;h2 id="5-conclusion-data-doesnt-lie-but-people-can-lie-with-data">5. Conclusion: Data doesn&amp;rsquo;t lie, but people can lie with data
&lt;/h2>&lt;p>Simpson&amp;rsquo;s Paradox warns of &lt;strong>&amp;ldquo;the danger of making judgments based solely on overall data like averages or totals&amp;rdquo;&lt;/strong>.&lt;/p>
&lt;p>The world is overflowing with companies, politicians, and media that cherry-pick only &amp;ldquo;overall numbers&amp;rdquo; to appeal in ways convenient to them.
Even if told &amp;ldquo;Our Product A has higher overall satisfaction than Competitor&amp;rsquo;s Product B!&amp;rdquo;, if you break it down into &amp;ldquo;young demographics&amp;rdquo; and &amp;ldquo;elderly demographics&amp;rdquo;, Competitor&amp;rsquo;s Product B might be winning in both groups.&lt;/p>
&lt;p>When looking at data, having a skeptical eye that doesn&amp;rsquo;t get fooled by superficial &amp;ldquo;overall&amp;rdquo; numbers and asks, &amp;ldquo;Is there an extreme bias in the proportion of groups due to variables hidden behind (age, gender, severity, etc.)?&amp;rdquo; becomes the strongest weapon for surviving the modern information society.&lt;/p></description></item></channel></rss>