{"id":1027,"date":"2026-10-14T03:16:00","date_gmt":"2026-10-14T03:16:00","guid":{"rendered":"https:\/\/freestatisticaltools.com\/blog\/?p=1027"},"modified":"2026-10-14T03:16:00","modified_gmt":"2026-10-14T03:16:00","slug":"chi-square-test-of-independence","status":"publish","type":"post","link":"https:\/\/freestatisticaltools.com\/blog\/chi-square-test-of-independence\/","title":{"rendered":"Chi-Square Test of Independence: Step-by-Step Guide with Example"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>chi-square (\u03c7\u00b2) test of independence<\/strong> checks whether two categorical variables are related. Is product preference related to age group? Is vaccination status related to region? Do pass rates differ between schools? If both of your variables are categories rather than measurements, this is usually the test you need.<\/p>\n\n\n<div class=\"fst-tool\"><span class=\"ico\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"3\" width=\"8\" height=\"8\" rx=\"1.5\"\/><rect x=\"13\" y=\"3\" width=\"8\" height=\"8\" rx=\"1.5\"\/><rect x=\"3\" y=\"13\" width=\"8\" height=\"8\" rx=\"1.5\"\/><rect x=\"13\" y=\"13\" width=\"8\" height=\"8\" rx=\"1.5\"\/><\/svg><\/span><span><span class=\"t-eyebrow\">Free tool \u00b7 runs in your browser<\/span><a class=\"t-name\" href=\"https:\/\/freestatisticaltools.com\/chi-square-test-calculator\/\" style=\"text-decoration:none;color:inherit\">Chi-Square Test of Independence Calculator<\/a><span class=\"t-desc\">Free chi-square test calculator from raw data or a contingency table: expected counts, Yates correction, likelihood ratio, Cram\u00e9r\u2019s V and residuals.<\/span><\/span><a class=\"btn accent\" href=\"https:\/\/freestatisticaltools.com\/chi-square-test-calculator\/\" data-tool=\"chi-square-test-calculator\">Run a chi-square test \u2192<\/a><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">When to use the chi-square test of independence<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You have <strong>two categorical variables<\/strong> (nominal or ordinal), for example gender \u00d7 voting intention, or treatment group \u00d7 recovered (yes\/no).<\/li>\n\n<li>Each participant appears in <strong>exactly one cell<\/strong> of the table.<\/li>\n\n<li>Your data are <strong>counts<\/strong> (frequencies), not percentages or means.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you have a single categorical variable and want to compare its distribution with expected proportions (for example, &quot;are the four flavours chosen equally often?&quot;), use the <a href=\"\/chi-square-goodness-of-fit-calculator\/\">chi-square goodness-of-fit test<\/a> instead. For the same people measured twice on a yes\/no outcome, use the <a href=\"\/mcnemar-test-calculator\/\">McNemar test<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hypotheses<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u2080:<\/strong> the two variables are independent (no association).<\/li>\n\n<li><strong>H\u2081:<\/strong> the two variables are associated.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How the test works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The test compares the <strong>observed<\/strong> counts in each cell with the counts you would <strong>expect<\/strong> if the variables were unrelated. For each cell:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>expected count = (row total \u00d7 column total) \u00f7 grand total<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The \u03c7\u00b2 statistic adds up the squared differences, scaled by the expected counts:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\u03c7\u00b2 = \u03a3 (observed \u2212 expected)\u00b2 \u00f7 expected<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The degrees of freedom are (rows \u2212 1) \u00d7 (columns \u2212 1). The bigger \u03c7\u00b2 is relative to its degrees of freedom, the stronger the evidence of an association.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Assumptions<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Independent observations.<\/strong> Each person is counted once.<\/li>\n\n<li><strong>Adequate expected counts.<\/strong> No expected count below 1, and no more than 20% of cells with expected counts below 5. For 2\u00d72 tables with small expected counts, use <a href=\"\/fishers-exact-test-calculator\/\">Fisher&#39;s exact test<\/a>.<\/li>\n\n<li><strong>Counts, not percentages.<\/strong> Convert percentages back to counts before running the test.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Worked example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A brand surveys 300 customers and asks whether they would recommend it. It wants to know if recommendation differs by age group.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Observed counts<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Would recommend?<\/th><th>18\u201329<\/th><th>30\u201349<\/th><th>50+<\/th><th>Total<\/th><\/tr><\/thead><tbody><tr><td>Yes<\/td><td>62<\/td><td>48<\/td><td>30<\/td><td>140<\/td><\/tr><tr><td>No<\/td><td>38<\/td><td>52<\/td><td>70<\/td><td>160<\/td><\/tr><tr><td>Total<\/td><td>100<\/td><td>100<\/td><td>100<\/td><td>300<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Expected counts<\/strong> (if age and recommendation were unrelated): 46.7 &quot;yes&quot; and 53.3 &quot;no&quot; in every age group. All expected counts are well above 5, so the assumption is met.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Result:<\/strong> \u03c7\u00b2(2, N = 300) = 20.68, p &lt; .001.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Recommendation rates clearly differ by age group: 62% of 18\u201329-year-olds would recommend the brand, compared with 48% of 30\u201349-year-olds and 30% of those aged 50 and over.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Which cells drive the result? Standardized residuals<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A significant \u03c7\u00b2 tells you there is an association somewhere. <strong>Adjusted standardized residuals<\/strong> show where. Values beyond \u00b11.96 indicate cells that differ significantly from expectation at \u03b1 = .05 (beyond \u00b12.58 for \u03b1 = .01).<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Would recommend?<\/th><th>18\u201329<\/th><th>30\u201349<\/th><th>50+<\/th><\/tr><\/thead><tbody><tr><td>Yes<\/td><td><strong>+3.76<\/strong><\/td><td>+0.33<\/td><td><strong>\u22124.09<\/strong><\/td><\/tr><tr><td>No<\/td><td><strong>\u22123.76<\/strong><\/td><td>\u22120.33<\/td><td><strong>+4.09<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Younger customers recommend more often than expected, and customers aged 50+ less often. The middle group is close to expectation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Effect size: Cram\u00e9r&#39;s V<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u03c7\u00b2 grows with sample size, so it is not an effect size. Use <strong>Cram\u00e9r&#39;s V<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>V = \u221a( \u03c7\u00b2 \u00f7 (N \u00d7 (k \u2212 1)) )<\/code>, where k is the smaller of the number of rows and columns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, V = \u221a(20.68 \u00f7 (300 \u00d7 1)) = <strong>.26<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rough benchmarks depend on the degrees of freedom. For df* = k \u2212 1 = 1, Cohen&#39;s guidelines are .10 (small), .30 (medium) and .50 (large); for df* = 2 they are about .07, .21 and .35. So V = .26 is a small-to-medium association. For 2\u00d72 tables, Cram\u00e9r&#39;s V equals the phi coefficient (\u03c6).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to report it in APA 7<\/h2>\n\n\n\n<div class=\"fst-report\"><b>How to report it (APA 7)<button type=\"button\" data-copy-report>Copy<\/button><\/b><div><p>A chi-square test of independence showed a significant association between age group and willingness to recommend the brand, \u03c7\u00b2(2, <i>N<\/i> = 300) = 20.68, <i>p<\/i> &lt; .001, Cram\u00e9r&#39;s <i>V<\/i> = .26. Customers aged 18\u201329 were more likely to recommend the brand (62%) than those aged 30\u201349 (48%) or 50 and over (30%).<\/p><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Include the contingency table (counts and percentages) in your results section or an appendix. Readers need it to understand the pattern.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Yates&#39; correction and the likelihood ratio test<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Yates&#39; continuity correction<\/strong> is sometimes applied to 2\u00d72 tables. It makes the test conservative, and many statisticians no longer recommend it; Fisher&#39;s exact test is a better option when counts are small.<\/li>\n\n<li>The <strong>likelihood ratio chi-square (G\u00b2)<\/strong> is an alternative statistic that usually gives very similar results with adequate samples.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The free <a href=\"\/chi-square-test-calculator\/\">chi-square calculator<\/a> reports Pearson&#39;s \u03c7\u00b2, the Yates-corrected value for 2\u00d72 tables, the likelihood ratio test, expected counts, residuals and Cram\u00e9r&#39;s V, so you can report whichever your field expects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common mistakes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Running the test on percentages.<\/strong> It needs raw counts.<\/li>\n\n<li><strong>Ignoring small expected counts.<\/strong> Merge sparse categories if that makes sense, or use Fisher&#39;s exact test.<\/li>\n\n<li><strong>Counting the same person more than once,<\/strong> for example with multiple-response survey questions.<\/li>\n\n<li><strong>Stopping at &quot;significant&quot;.<\/strong> Report Cram\u00e9r&#39;s V and describe which cells drive the effect.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<div class=\"fst-faq\"><details><summary>What is the minimum sample size for a chi-square test?<\/summary><div class=\"a\"><p>There is no fixed minimum sample size. The rule is about expected counts: no expected count below 1, and no more than 20% of cells below 5. If that fails in a 2\u00d72 table, use Fisher&#39;s exact test.<\/p><\/div><\/details><details><summary>What is the difference between chi-square test of independence and goodness of fit?<\/summary><div class=\"a\"><p>The test of independence checks whether two categorical variables are related. The goodness-of-fit test compares one categorical variable with a set of expected proportions.<\/p><\/div><\/details><details><summary>How do I interpret Cram\u00e9r&#039;s V?<\/summary><div class=\"a\"><p>Cram\u00e9r&#39;s V runs from 0 (no association) to 1 (perfect association). Interpretation depends on table size; for a 2\u00d72 table, about .10 is small, .30 medium and .50 large.<\/p><\/div><\/details><details><summary>Can I use chi-square for ordinal variables?<\/summary><div class=\"a\"><p>Yes, but it ignores the ordering. If both variables are ordinal, a test of trend or a rank correlation such as Spearman&#39;s rho can be more powerful.<\/p><\/div><\/details><\/div>\n\n\n<div class=\"fst-report\"><b>Cite the tool (APA 7)<button type=\"button\" data-copy-report>Copy<\/button><\/b><div>Xavier, B. (2026). <i>Free Statistical Tools<\/i> [Computer software]. Zenodo. https:\/\/doi.org\/10.5281\/zenodo.23372149 (web app: https:\/\/freestatisticaltools.com\/chi-square-test-calculator\/)<\/div><small>Name the tool in your methods: \u201cThe analysis was carried out with the Chi-Square Test of Independence Calculator in Free Statistical Tools.\u201d<\/small><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Test whether two categorical variables are related, with a worked example, the expected-count rule, standardized residuals, Cram\u00e9r&#8217;s V and an APA write-up.<\/p>\n","protected":false},"author":1,"featured_media":1028,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_fst_seo_title":"Chi-Square Test of Independence: Example, Cram\u00e9r's V, APA","_fst_meta_desc":"How to run a chi-square test of independence, check expected counts, read standardized residuals, calculate Cram\u00e9r's V and report the result in APA style.","_fst_primary_tool":"chi-square-test-calculator","_fst_canonical":"","_fst_noindex":false,"_fst_no_toc":false,"_fst_no_autolink":false,"footnotes":""},"categories":[5],"tags":[19,25,24,18],"class_list":["post-1027","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-categorical-data","tag-apa-style","tag-categorical-data","tag-chi-square","tag-effect-size"],"_links":{"self":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts\/1027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/comments?post=1027"}],"version-history":[{"count":0,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts\/1027\/revisions"}],"wp:attachment":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/media?parent=1027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/categories?post=1027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/tags?post=1027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}