Chi Square Test Calculator
Calculate chi square test instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Chi Square Test Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: Chi-Square = Sum[(Observed - Expected)^2 / Expected]
Worked example โ Chi-square = 14.29, df = 1, p < 0.001 โ Significant association
Formula
Chi-Square = Sum[(Observed - Expected)^2 / Expected]
The chi-square statistic sums the squared differences between observed and expected frequencies, each divided by the expected frequency. Degrees of freedom = (rows - 1) x (columns - 1). Compare the statistic to the chi-square distribution to find the p-value.
Worked Examples
Example 1: Gender and Product Preference
Problem:Survey: 50 males prefer Product A, 30 prefer B. 20 females prefer A, 40 prefer B. Is there an association between gender and preference?
Solution:Observed: [[50,30],[20,40]], Grand total = 140 Expected: [[35,35],[35,35]] (if independent, no difference) Chi-square = (50-35)^2/35 + (30-35)^2/35 + (20-35)^2/35 + (40-35)^2/35 = 6.43 + 0.71 + 6.43 + 0.71 = 14.29 df = 1, p < 0.001
Result:Chi-square = 14.29, df = 1, p < 0.001 โ Significant association
Frequently Asked Questions
What is the chi-square test of independence?
The chi-square test of independence determines whether there is a statistically significant association between two categorical variables. It compares observed frequencies (your actual data) to expected frequencies (what you would expect if the variables were independent). A large chi-square statistic indicates that observed frequencies differ substantially from expected frequencies, suggesting the variables are associated.
How are expected values calculated?
For a test of independence, expected values are calculated as: Expected = (Row Total x Column Total) / Grand Total. This formula gives you the frequency you would expect in each cell if the row and column variables were completely independent. You can also enter custom expected values if testing a different hypothesis (goodness of fit).
What are the assumptions of the chi-square test?
Key assumptions: (1) Data are frequencies/counts, not percentages or means. (2) Categories are mutually exclusive โ each observation falls in exactly one cell. (3) Observations are independent. (4) Expected frequency in each cell should be at least 5 (Cochran's rule). If expected values are below 5, consider Fisher's exact test or combining categories.
What is Cramer's V?
Cramer's V is an effect size measure for the chi-square test, ranging from 0 (no association) to 1 (perfect association). It adjusts for table size, making it comparable across different contingency tables. Guidelines: V < 0.1 is negligible, 0.1-0.3 is small, 0.3-0.5 is medium, and > 0.5 is large. Unlike the chi-square statistic, Cramer's V is not affected by sample size.
How do I interpret a p-value in hypothesis testing?
A p-value is the probability of observing your data (or more extreme) if the null hypothesis is true. A p-value below 0.05 is conventionally considered statistically significant, meaning there is less than a 5% chance the result is due to random variation. It does not measure effect size or practical importance.
When should I use a t-test versus a z-test?
Use a z-test when the population standard deviation is known and the sample size is large (n > 30). Use a t-test when the population SD is unknown and you estimate it from the sample. For small samples (n < 30), the t-distribution accounts for the extra uncertainty in estimating SD.
What is a chi-square test used for?
The chi-square test compares observed frequencies to expected frequencies in categorical data. A goodness-of-fit test checks if data follows an expected distribution. A test of independence checks if two categorical variables are related. The test statistic increases as observed and expected frequencies diverge.
References
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎDescriptive Statistics Calculator
Calculate descriptive statistics with inputs, formulas, and instant results.
๐งฎBayesian Posterior Calculator
Calculate bayesian posterior with inputs, formulas, and instant results.
๐งฎFalse Discovery Rate Calculator
Calculate false discovery rate with inputs, formulas, and instant results.
๐งฎCorrelation Coefficient Calculator
Calculate correlation coefficient with inputs, formulas, and instant results.
๐งฎBinomial Distribution Calculator
Calculate binomial distribution with inputs, formulas, and instant results.
๐งฎZtest Proportions Calculator
Calculate ztest proportions with inputs, formulas, and instant results.
๐งฎEffect Size Calculator
Calculate effect size with inputs, formulas, and instant results.