Chi-Square Test Calculator

Calculate chi-square tests for goodness-of-fit and independence.

Test Configuration

Chi-Square Test Formulas

Chi-Square Statistic

The chi-square statistic is calculated as:

·2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}

Where:

  • OO = Observed frequency
  • EE = Expected frequency

Expected Frequencies

For Independence Test:

Eij=Ri×CjNE_{ij} = \frac{R_i \times C_j}{N}

Where:

  • EijE_{ij} = Expected frequency for cell (i,j)
  • RiR_i = Sum of observed frequencies in row i
  • CjC_j = Sum of observed frequencies in column j
  • NN = Total sum of all observed frequencies

For Goodness-of-Fit Test:

Expected frequencies are either specified or assumed to be equal across all cells.

Degrees of Freedom

For Goodness-of-Fit Test:

df=k−1df = k - 1

Where k is the number of categories (cells).

For Independence Test:

df=(r−1)×(c−1)df = (r - 1) \times (c - 1)

Where r is the number of rows and c is the number of columns.