Chi-Square Calculator
Goodness of fit ยท independence ยท ฯยฒ distribution
Result
Enter data and click Calculate
Compute chi-square statistic, p-value, degrees of freedom, and effect size.
Chi-Square Distribution
Python Compiler
What Is a Chi-Square Test?
A chi-square test (ฯยฒ) is a statistical hypothesis test used to determine whether there is a significant association between categorical variables or whether observed frequencies differ from expected frequencies. It is one of the most widely used non-parametric tests in statistics.
Categorical Analysis
Analyze relationships between categorical variables such as gender, preference, treatment group, or survey response.
Expected vs Observed
Compare what you observed in your data against what you would expect under the null hypothesis of no association.
Statistical Significance
Determine if the difference between observed and expected frequencies is large enough to reject the null hypothesis.
Chi-Square Formula
E11 = (40 ร 50) / 100 = 20, E12 = (40 ร 50) / 100 = 20
E21 = (60 ร 50) / 100 = 30, E22 = (60 ร 50) / 100 = 30
ฯยฒ = (30โ20)ยฒ/20 + (10โ20)ยฒ/20 + (20โ30)ยฒ/30 + (40โ30)ยฒ/30 = 5 + 5 + 3.33 + 3.33 = 16.67
df = (2โ1)(2โ1) = 1, p-value < 0.001 โ Reject Hโ
Interpreting Results
โ Reject Hโ
When p-value < ฮฑ, the observed frequencies differ significantly from expected. There is a statistically significant association between the variables.
โ Fail to Reject Hโ
When p-value โฅ ฮฑ, there is insufficient evidence to conclude an association. The observed differences could be due to chance.
๐ Effect Size (Cramรฉrโs V)
Measures strength of association: V โ 0.1 is small, V โ 0.3 is medium, and V โฅ 0.5 indicates a large effect size.
๐ฏ Practical Significance
A statistically significant result may not be practically meaningful. Always consider effect size, sample size, and real-world context alongside the p-value.
Assumptions & Limitations
- Independence: Observations must be independent of each other. Each subject contributes to only one cell.
- Sample size rule: Expected frequencies should be at least 5 in 80% of cells, and no cell should have an expected frequency below 1.
- Categorical data: Variables must be categorical (nominal or ordinal). Chi-square is not appropriate for continuous data.
- Random sampling: Data should be obtained through random sampling from the population of interest.
Tip: When expected frequencies are too small (especially in 2ร2 tables), use Fisherโs exact test instead. For ordinal data with a natural ordering, consider the Cochran-Armitage trend test.
Applications
| Field | Example Use Case |
|---|---|
| Medicine | Test whether treatment outcome is associated with patient group |
| Marketing | Analyze if product preference differs by demographic segment |
| Genetics | Test if observed genotype ratios match Mendelian expected ratios |
| Education | Determine if pass/fail rates differ across teaching methods |
| Quality Control | Check if defect rates are independent of production line |
| Social Sciences | Examine if voting preference is related to age group or region |