Chi-Square Goodness of Fit Calculator Formula

Understand the math behind the chi-square goodness of fit calculator. Each variable explained with a worked example.

Formulas Used

Chi-square Contribution

chi2_contribution = pow(observed - expected, 2) / expected

Deviation (O - E)

deviation = observed - expected

Degrees of Freedom

df = k - 1

Variables

VariableDescriptionDefault
observedObserved Frequency45
expectedExpected Frequency50
kNumber of Categories5

How It Works

Chi-Square Goodness of Fit

chi2 = Sum((O-E)^2/E)

Tests observed vs expected frequency distribution.

Worked Example

O=45, E=50, k=5.

observed = 45expected = 50k = 5
  1. 01chi2 = 25/50 = 0.5
  2. 02df = 4