Skip to content
Statistics Medium #chi-square#categorical#goodness-of-fit

Chi-Square Test

Observed vs expected frequency table with paired bar chart and chi-square statistic callout.

A free, animated chi-square test you can read here or embed on any website, from Scrollchart.

Chi-Square Test

Chi-Square TestX² = sum[(O - E)² / E], df = categories - 1 = 2OutcomeSickMildNoneObservedExpected2040contrib: 10.04060contrib: 6.7140100contrib: 16.0

A 2x3 frequency table (Vaccinated vs Not x Sick/Mild/None outcome). Cells show observed (blue) and expected (purple) counts. Paired bar chart shows the frequency comparison. Callout box: X2=60.7, df=2, critical=5.99, p<0.001, Reject H0.

Good for

  • Epidemiology and vaccine efficacy explainers
  • Survey data analysis
  • Marketing analytics

Source & accuracy

This chi-square test is an editorial illustration built to represent the concept accurately. Where it shows figures, they are typical or representative values chosen to make the relationship clear, not a single underlying dataset. The diagram and its explainer are reviewed and maintained centrally, and updated over time as understanding improves.

Observed versus expected frequencies

The chi-square test starts with a contingency table comparing what you actually counted (observed) against what theory predicts (expected) if the variables were unrelated. If a coin is fair, you expect 50 heads and 50 tails in 100 flips; observed results rarely match exactly.

The test quantifies the mismatch and asks whether it's large enough to reject the null hypothesis that the two variables are independent. A tiny chi-square value suggests the data aligns with randomness; a large value suggests a real relationship.

Interpreting the distribution and verdict

The chi-square distribution (a right-skewed, non-negative distribution) shows the probability of observing your test statistic under the null hypothesis. The diagram overlays a vertical line at your computed chi-square value and shades the rejection region at the tail, where unlikely values cluster.

Embed this diagram

Add this animated chi-square test to your own site. Copy one line of HTML, or use the embed builder for theme and sizing options.

Reference

What this is
A free, embeddable, animated chi-square test for any website.
Who uses it
Data journalists, Researchers & academics, Content marketers, News organizations.
How to embed
Copy one line of HTML. No signup. No watermark. Works in WordPress, Webflow, Ghost, Substack, plain HTML.
File size
iframe embed, ~80 KB gzipped (loads on demand, does not block your page paint).
License
Free forever. Editorial explainer text included; updated centrally over time.

Embed format options

Copy the universal HTML snippet, the WordPress shortcode, or an iframe fallback - see the WordPress plugin page for details. Any format keeps the same Core Web Vitals profile and the same explainer text.

Embed snippet
<div data-scrollchart="chi-square-test" data-scrollchart-v="1"></div>
<script src="https://scrollchart.com/embed.js" async></script>

Frequently asked questions

Where can I get a free animated "Chi-Square Test" for my website?
Scrollchart provides "Chi-Square Test" as a free, embeddable animated diagram you can add to any website with one line of HTML. No signup is required and there is no watermark. The diagram and its explainer text are served from scrollchart.com, so the embed stays current without any maintenance on your end.
How do I embed a chi-square test in a blog post or article?
Paste the one-line HTML snippet from the Scrollchart diagram page into your post editor. It works in WordPress, Webflow, Ghost, and plain HTML with no plugin required. The animated diagram and its explainer text load from scrollchart.com and render directly in your page DOM.