Chi-Square Contingency Cells & Simpson's Paradox Reverser
Inspect (O − E)²/E cell contributions and dynamically reverse aggregated rates in Simpson's Paradox via subgroup weighting.
Compare observed counts against expected independence—and witness how combining two departments can completely reverse a winning rate.
Loaded die / Benford fraud checks, A/B categorical conversions, and confounding bias in observational studies.
How does Pearson's quantify deviation from categorical independence—and how can pooling subgroups flip every comparison upside down in Simpson's Paradox?
Under independence inside an contingency table, expected cell counts obey , and normalized squared residuals follow with degrees of freedom.
Yet even a statistically clear aggregate table can invert true subgroup proportions whenever an unmodeled confounding variable shifts weights unevenly across categories—requiring stratified analysis.
How can Treatment A beat Treatment B inside BOTH mild and severe patient subgroups, yet lose to Treatment B when the hospital combines everyone together?
Edit Observed vs. Expected contingency bars to watch Pearson χ² residuals grow, then switch to the Simpson's Paradox Reverser and slide subgroup sizes to flip the aggregated winner.
Observational totals without stratification hide confounding variables! Next, Chapter S.5.3 compares 3 or more continuous groups at once via One-Way ANOVA.
Imagine rolling a board-game die 120 times and getting thirty 6s instead of the expected twenty. Is the die rigged, or just lucky? Karl Pearson's Chi-Square () test scores every category by how far Observed () counts drift from Expected () counts—measured relative to . Even more eye-opening: in real hospitals or admissions offices, pooling two unequal sub-groups into one table can completely reverse which option wins—that optical illusion is Simpson's Paradox!
Preparing interactive canvas & numerical solver…
wanna math drafting viewport
Why divide by ? Being off by 5 counts out of is huge, whereas being off by 5 counts out of is tiny! Degrees of freedom are for a table or for goodness-of-fit.
From S.2.1, two events are independent when . Multiplying by gives the exact counts we expect if row & column are unrelated!
Toss a coin 100 times ( Heads, Tails) and observe 60 Heads, 40 Tails:
With , , giving !
Never feed percentages into —always feed raw counts (and switch to Fisher's Exact Test whenever any ). Second, always inspect sub-group strata: Treatment A can lose overall only because doctors gave it to harder cases!
Chi-Square compares counts across multiple categories. What if you want to compare numerical averages across 3 or 4 treatments simultaneously without triggering false alarms? Welcome to One-Way ANOVA in S.5.3!
Once marginal row totals and column totals are fixed from the table, filling an upper-left block determines all remaining border cells uniquely!
For any contingency table, Pearson's with matches the squared two-proportion -statistic identically—with expected counts guarding continuity.
Weighted averages depend on subgroup denominators! When Treatment A gets assigned mostly to severe cases (low survival), its pooled average looks worse even while beating Treatment B inside every stratum.
Inspect (O − E)²/E cell contributions and dynamically reverse aggregated rates in Simpson's Paradox via subgroup weighting.
Mild cases: A (93%) > B (87%). Severe cases: A (73%) > B (69%). Adjust how many Severe vs. Mild cases each treatment receives!