Perform chi-square goodness-of-fit and independence tests online. Get χ² statistic, p-value, Cramér's V, expected frequencies, and standardized residuals.
The chi-square test is one of the most widely used statistical tests for categorical data. It comes in two main flavors: the goodness-of-fit test, which checks whether observed frequencies match an expected distribution, and the test of independence, which determines whether two categorical variables are associated in a contingency table.
This calculator handles both test types. For goodness of fit, enter your observed and expected frequencies. For independence, enter your contingency table data. The calculator returns the χ² statistic, p-value, degrees of freedom, Cramér's V effect size, expected frequencies, standardized residuals, and a clear accept/reject decision.
Chi-square tests appear everywhere: testing whether a die is fair, checking if genetics follow Mendelian ratios, analyzing survey cross-tabulations, evaluating A/B test results with categorical outcomes, and assessing whether customer preferences differ across demographic groups. Check the example with realistic values before reporting. Use the steps shown to verify rounding and units. Cross-check this output using a known reference case.
Computing chi-square by hand involves squaring differences between observed and expected frequencies for every cell, summing them, looking up critical values in a table, and manually assessing significance. This calculator does it instantly for any table size, plus computes Cramér's V effect size and standardized residuals to identify which cells deviate most. It eliminates errors and lets you focus on interpreting the results.
Chi-Square Statistic: χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ Degrees of Freedom: Goodness of Fit: df = k − 1 Independence: df = (r − 1)(c − 1) Expected Frequency (Independence): Eᵢⱼ = (Row Total × Col Total) / Grand Total Cramér's V: V = √(χ² / (n × min(r−1, c−1))) Standardized Residual: e = (O − E) / √E
Result: χ²(2) = 16.8269, p = 0.0002
A 2×3 contingency table with 200 total observations yields a chi-square statistic of 16.83 with 2 degrees of freedom. The p-value of 0.0002 is far below 0.05, indicating a significant association between the row and column variables. Cramér's V = 0.29, suggesting a medium effect size.
The goodness-of-fit test is the go-to method for checking whether observed data matches an expected probability distribution. Geneticists use it to verify Mendelian ratios (e.g., 9:3:3:1 in dihybrid crosses), quality engineers check if defect counts follow Poisson distributions, and pollsters verify if demographic samples match census proportions.
In a test of independence, each cell of the contingency table represents the frequency of a specific combination of categories. Expected frequencies are computed under the assumption of independence: E = (row total × column total) / grand total. Large deviations between observed and expected values in specific cells drive the chi-square statistic upward. Standardized residuals help pinpoint exactly which combinations are surprising.
Chi-square tests assume independent observations (each subject contributes to exactly one cell), adequate expected frequencies (usually ≥ 5 in each cell), and a fixed total sample size. Violating these can lead to unreliable p-values. For matched or paired data, use McNemar's test. For tables with small expected counts, Fisher's exact test is more appropriate.
Goodness of fit compares one categorical variable's observed distribution against a theoretical expected distribution. Independence tests whether two categorical variables are related in a contingency table. Both use the same χ² formula but differ in degrees of freedom and interpretation.
For goodness of fit, it means the observed distribution significantly differs from the expected one. For independence, it means the two variables are associated (not independent). It does not tell you the direction or magnitude of the relationship — use residuals and Cramér's V for that.
When any expected cell frequency is below 5, or when your total sample size is small (under 20). Fisher's exact test computes the exact probability without relying on the chi-square distribution approximation.
No. Chi-square only tells you whether an association exists, not its direction. Examine standardized residuals to see which specific cells contribute most and in which direction (positive = more than expected, negative = less).
Cramér's V is an effect size measure for chi-square tests of independence, ranging from 0 to 1. It's analogous to a correlation coefficient for categorical data and adjusts for table size.
Not directly. Chi-square requires categorical frequency counts. If you have continuous data, you must first bin it into categories (e.g., age ranges). However, binning choices affect results, so parametric tests are usually preferred for continuous data.