Calculate Goodness-of-Fit Observed vs Expected

Enter observed counts (O) and expected counts (E) separated by commas.

Observed frequencies separated by commas.
Theoretical expected frequencies.

Calculation Results

Primary Metric Output --
Metric Breakdown 1--
Metric Breakdown 2--
Metric Breakdown 3--
Metric Breakdown 4--
Metric Breakdown 5--
Mathematical Standard--

Calculated using Chi-Square Goodness-of-Fit equations: \chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}

*Note: Goodness-of-Fit tests whether observed categorical counts conform to a theoretical probability distribution.

Quick Summary

The Chi-Square Goodness of Fit Calculator evaluates $\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}$, degrees of freedom ($df = k-1$), $p$-value, and Cramér's V effect size.

Formula Explanation

\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}, \quad df = k - 1
\text{Cramér\'s V} = \sqrt{\frac{\chi^2}{N(k - 1)}}

How It Works

Goodness-of-Fit compares observed category counts $O_i$ against theoretical expected counts $E_i$. The Chi-Square Goodness of Fit Calculator evaluates normalized squared residuals and checks if departures are statistically significant.

Step-by-Step Worked Example

Practical Problem: A die is rolled $N = 100$ times with observed counts: 25, 30, 20, 25 across $k = 4$ categories. Test if outcome distribution is uniform ($E_i = 25$).

  1. Step 1: Calculate $(O_i - E_i)^2 / E_i$ for category 1: $(25-25)^2 / 25 = 0 / 25 = \mathbf{0.00}$.
  2. Step 2: Calculate for category 2: $(30-25)^2 / 25 = 25 / 25 = \mathbf{1.00}$.
  3. Step 3: Calculate for category 3: $(20-25)^2 / 25 = 25 / 25 = \mathbf{1.00}$.
  4. Step 4: Calculate for category 4: $(25-25)^2 / 25 = 0 / 25 = \mathbf{0.00}$. Sum $\chi^2 = \mathbf{2.0000}$.
  5. Step 5: Determine df ($df = 3$) & p-value: $p$-value for $\chi^2 = 2.00, df = 3 \rightarrow \mathbf{0.5724\text{ (Fail to reject } H_0)}$.

Real-World Calculation Examples

Scenario 1: 4-Category Uniform Test (O = 25, 30, 20, 25)

Parameters: k = 4, E = 25 each
Result: χ² = 2.0000, p = 0.5724 (Distribution fits uniform model).

Scenario 2: Mendelian Genetics 9:3:3:1 Pea Inheritance

Parameters: k = 4 categories, expected ratio 9:3:3:1
Result: Goodness-of-fit test.

Scenario 3: Customer Preference Across 5 Products

Parameters: Equal 20% market share model
Result: Goodness-of-fit evaluation.

Scenario 4: Days of Week Hospital Admission Distribution

Parameters: Mon-Sun uniform admissions
Result: Goodness-of-fit evaluation.

Key Benefits of Using This Calculator

Custom Observed & Expected Inputs

Supports any custom array of observed $O_i$ and expected $E_i$ counts.

Cramér's V Effect Size

Calculates Cramér's V effect size to measure magnitude of divergence.

Automatic df Calculation

Automatically determines degrees of freedom $df = k - 1$.

100% Free & Client-Side

Executes locally in your browser with zero latency or web server transmission.

Frequently Asked Questions (FAQ)

What is a Chi-Square Goodness-of-Fit test?

The Chi-Square Goodness-of-Fit test checks if sample categorical frequencies fit a specified theoretical probability distribution.

What is null hypothesis ($H_0$) in Goodness-of-Fit test?

$H_0$: The observed frequency distribution matches the expected distribution.

How do I calculate expected frequencies if given probabilities?

Expected count $E_i = N \times p_i$, where $N$ is total sample size and $p_i$ is theoretical probability.

How do I calculate Goodness-of-Fit in Excel?

Use formula =CHISQ.TEST(observed_range, expected_range).

What are degrees of freedom for Goodness-of-Fit?

$df = k - 1 - m$, where $k$ is number of categories and $m$ is number of estimated distribution parameters.

What minimum expected count is required per category?

Each category should have expected count $E_i \ge 5$.

Can Goodness-of-Fit test continuous distributions (Normal/Poisson)?

Yes — by binning continuous data into discrete interval bins ($k$ bins).

What alternative test exists for continuous distributions?

The Kolmogorov-Smirnov (K-S) test and Anderson-Darling test do not require binning continuous data.

What is Cramér's V formula for Goodness-of-Fit?

$\text{Cramér's V} = \sqrt{\frac{\chi^2}{N(k - 1)}}$.

Why does $O_i - E_i$ get squared?

Squaring prevents positive and negative deviations from cancelling out and penalizes larger discrepancies.