Statistics and research
Chi-square goodness-of-fit calculator
Test whether observed category counts fit equal or specified expected proportions, with each category’s contribution and residual.
Runs in your browser. What you enter stays on this page and is not uploaded.
Results
- Chi-square Σ(O − E)² / E
- 9.9901434
- Degrees of freedom k − 1 − estimated parameters
- 4
- p-value
- 0.04059
- Total count
- 186
- Expected proportions
- As entered, rescaled to sum to 1
- Conclusion
- The counts differ from the expected distribution (significant at the 5% level).
| Category | Observed | Expected | (O − E)² / E | Pearson residual |
|---|---|---|---|---|
| Category 1 | 89 | 74.4 | 2.86505 | 1.693 |
| Category 2 | 37 | 37.2 | 0.00107527 | -0.03279 |
| Category 3 | 30 | 37.2 | 1.39355 | -1.18 |
| Category 4 | 28 | 27.9 | 0.000358423 | 0.01893 |
| Category 5 | 2 | 9.3 | 5.73011 | -2.394 |
Method and limits
How to use it
Enter the observed count for each category. Leave the expected box blank to test equal proportions, or enter the expected proportions, percentages or counts in the same order — they are rescaled to sum to 1. If you estimated parameters from the same data (for example a Poisson mean), enter how many.
Formulas
- Expected count Ei = n × pi.
- χ² = Σ (Oi − Ei)² / Ei with k − 1 − m degrees of freedom (k categories, m estimated parameters); p is the right tail.
- Pearson residual (O − E) / √E shows which categories deviate most.
Assumptions and limits
- Independent observations, each in one category; counts, not percentages.
- Expected counts of 5 or more in most categories; combine sparse categories otherwise.
- For two categories this is equivalent to a z-test of one proportion; for exact small-sample answers use a binomial or multinomial exact test.
Worked example
R’s example: observed 89, 37, 30, 28, 2 against proportions 40 : 20 : 20 : 15 : 5. Expected counts are 74.4, 37.2, 37.2, 27.9 and 9.3; χ² = 9.990 with 4 df, p = 0.0406. The last category (2 observed, 9.3 expected) contributes most.
References
Related tools
- Chi-square test of independence calculatorChi-square test for a contingency table of counts: expected counts, adjusted residuals, likelihood-ratio G², Cramér’s V and Yates’s correction for 2×2.
- Fisher’s exact test calculatorExact test for a 2×2 table: two-sided and one-sided p-values, the conditional maximum likelihood odds ratio and its exact confidence interval.
- Cohen’s kappa calculatorAgreement between two raters beyond chance: Cohen’s κ, linear or quadratic weighted κ, standard error, confidence interval and z-test.
- Effect size calculatorCohen’s d, Hedges’ g and Glass’s Δ from group means, or odds ratio, risk ratio and risk difference from a 2×2 table, each with confidence intervals.
- Standard deviation calculatorPaste data to get the standard deviation (sample and population), variance, mean, median, mode, quartiles with the method stated, IQR, outliers, skewness and kurtosis.
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.