Chi-Square Statistic Calculator Formula

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

Formulas Used

Chi-Square Statistic

chi_square = comp1 + comp2 + comp3

Component 1

component1 = comp1

Component 2

component2 = comp2

Component 3

component3 = comp3

Degrees of Freedom (k-1)

df = 2

Variables

VariableDescriptionDefault
o1Observed 130
e1Expected 125
o2Observed 220
e2Expected 225
o3Observed 350
e3Expected 350
comp1Derived value= pow(o1 - e1, 2) / e1calculated
comp2Derived value= pow(o2 - e2, 2) / e2calculated
comp3Derived value= pow(o3 - e3, 2) / e3calculated

How It Works

How to Calculate the Chi-Square Statistic

Formula

chi-square = Sum of [(Oi - Ei)^2 / Ei]

For each category, compute the squared difference between observed (O) and expected (E) frequencies, divided by the expected frequency. Sum these components. Larger values indicate greater discrepancy between observed and expected. Degrees of freedom = number of categories - 1.

Worked Example

Three categories with observed frequencies 30, 20, 50 and expected 25, 25, 50.

o1 = 30e1 = 25o2 = 20e2 = 25o3 = 50e3 = 50
  1. 01Component 1: (30-25)^2/25 = 25/25 = 1.0
  2. 02Component 2: (20-25)^2/25 = 25/25 = 1.0
  3. 03Component 3: (50-50)^2/50 = 0/50 = 0.0
  4. 04Chi-square = 1.0 + 1.0 + 0.0 = 2.0
  5. 05df = 3 - 1 = 2

Ready to run the numbers?

Open Chi-Square Statistic Calculator