A chi-square test of independence checks whether two categorical variables are related or whether any pattern in a table could just be chance. This calculator handles the common 2x2 case, where you have two rows and two columns of counts, such as treatment versus no treatment crossed with success versus failure. You enter the four observed counts, labelled a, b, c and d, and the tool works out the expected count for each cell from the row and column totals, then sums the squared differences between observed and expected, each divided by its expected value. The result is the chi-square statistic together with its degrees of freedom, which is always one for a 2x2 table. Researchers, students, marketers, and health and social science analysts in New Zealand use this to test associations, for example whether a campaign changed conversion or whether an outcome depends on a group. To read the result, compare the chi-square value with a critical value from a chi-square table at your chosen significance level, commonly 3.84 for one degree of freedom at the 5 percent level; a larger statistic suggests the variables are not independent. For the test to be reliable, use raw counts rather than percentages, make sure each expected count is at least five, and consider Yates continuity correction or Fisher's exact test when counts are small. Remember that the test shows association, not cause, so a significant result tells you the variables move together but not why. Always report the sample size alongside the statistic so others can judge the strength and reliability of your finding before drawing conclusions.
Expected = row total * column total / grand total. Chi-square = sum of (observed - expected)^2 / expected, df = 1.
The four counts give two row totals and two column totals that add to the grand total. Each cell's expected count is its row total times its column total divided by the grand total. The chi-square statistic sums the squared difference between observed and expected for each cell divided by that expected count, with one degree of freedom.
With a=30, b=10, c=20 and d=40 the totals give expected counts of 20, 20, 30 and 30. Each cell contributes (observed minus expected) squared over expected, which is 5, 5, 3.333 and 3.333. These sum to 16.667 with one degree of freedom.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
© 2019 to 2026 Calculate.co.nz. All rights reserved.