7.5334
2
113
116.66
-4.16
0.3327
3.1228
4.0779
0
0
7.5334
2
113
116.66
-4.16
0.3327
3.1228
4.0779
0
0
The Chi-Square Goodness of Fit Calculator tests whether observed frequency data match an expected theoretical distribution. This fundamental statistical test answers questions like: Do dice rolls follow a uniform distribution? Does a population match expected genetic ratios? Does survey response distribution match prior expectations?
Enter observed and expected counts for up to 5 categories to compute the chi-square statistic and degrees of freedom.
The goodness of fit test compares observed frequencies to expected frequencies derived from a hypothesized distribution. The null hypothesis states that the observed data follow the expected distribution.
The chi-square statistic is calculated as:
$$\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}$$
Where \(O_i\) is the observed frequency and \(E_i\) is the expected frequency for category \(i\). The degrees of freedom are \(df = k - 1\), where \(k\) is the number of categories. If parameters were estimated from the data, subtract an additional degree of freedom for each estimated parameter.
Under the null hypothesis, the statistic follows a chi-square distribution with \(k - 1\) degrees of freedom. Large values indicate poor fit between observed and expected distributions. Each category should have an expected frequency of at least 5 for the approximation to be reliable.
The test is one-tailed — only large chi-square values provide evidence against the null hypothesis, since the statistic measures total discrepancy between observed and expected frequencies.
To interpret the goodness of fit results:
Inputs
Results
Testing whether three outcomes occur with equal frequency. χ² = 6.25 > 5.991 (critical at α=0.05, df=2), suggesting the distribution is not uniform.
Inputs
Results
Mendel's pea experiment: testing 9:3:3:1 ratio. χ² = 0.47 << 7.815 (critical at α=0.05, df=3), consistent with the expected genetic ratio.
The goodness of fit test examines whether a single variable's observed frequencies match a specified expected distribution (one-way table). The test of independence examines whether two variables are associated using a two-way contingency table. Goodness of fit has one categorical variable; independence has two.
Expected frequencies come from the null hypothesis. For a uniform distribution, each expected frequency is N/k (total observations divided by categories). For specific theoretical ratios (e.g., Mendelian 9:3:3:1), multiply the total N by each proportion. The sum of expected frequencies should equal the sum of observed frequencies.
The chi-square approximation is unreliable when expected frequencies are below 5. Solutions include: (1) Combine adjacent categories to increase expected counts, (2) Use exact multinomial tests, or (3) Use simulation-based p-values. The rule of 5 is conservative; some sources suggest the test is adequate if no expected frequency is below 1 and no more than 20% are below 5.
Yes, you can test fit to any discrete distribution: uniform, binomial, Poisson, geometric, or any custom proportions. For continuous distributions, you first need to bin the data into categories, then compare observed bin frequencies to expected frequencies from the theoretical distribution.
Larger samples provide more statistical power to detect departures from the expected distribution. However, with very large samples, even trivially small deviations become statistically significant. Consider complementing the test with effect size measures or visual inspection (e.g., comparing observed vs. expected bar charts).
Key assumptions: (1) Data are frequency counts of mutually exclusive categories, (2) Observations are independent, (3) Expected frequency in each category is at least 5 (rule of thumb), (4) The categories are exhaustive — every observation falls into exactly one category. The test does not require normality of the underlying data.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
P-Value Calculator
Statistical Inference & Hypothesis Testing
Confidence Interval Calculator
Statistical Inference & Hypothesis Testing
Margin of Error Calculator
Statistical Inference & Hypothesis Testing
Sample Size Calculator
Statistical Inference & Hypothesis Testing
Critical Value Calculator
Statistical Inference & Hypothesis Testing
Z-Test Calculator
Statistical Inference & Hypothesis Testing