Advertisement

χ² Chi-Square Test Calculator

Compute chi-square statistic, expected frequencies, degrees of freedom, and p-value for a 2×2 to 4×4 contingency table.

×

Chi-Square Formula

χ² = Σ (O − E)² / E
where O = observed frequency, E = expected frequency
E_ij = (row_i total × col_j total) / grand total
df = (rows − 1) × (cols − 1)

How to Perform a Chi-Square Test

  1. 1
    Set Table Size
    Select the number of rows and columns that match your data categories.
  2. 2
    Enter Observed Counts
    Fill in each cell with the frequency count you observed in your data.
  3. 3
    Review Expected Frequencies
    The calculator shows what frequencies would be expected if the variables were independent.
  4. 4
    Interpret the Result
    If p < 0.05, reject H₀ — there is a statistically significant association between the variables.

Frequently Asked Questions

The chi-square test of independence determines whether two categorical variables are associated. For example, whether treatment type and recovery outcome are related, or whether gender and product preference are independent.

H₀ states that the two categorical variables are independent — knowing one variable tells you nothing about the other. A significant result means the variables are associated.

Expected frequencies are what you would expect in each cell if H₀ were true (complete independence). They are calculated from the row totals, column totals, and grand total.

The test requires that expected frequencies are ≥ 5 in at least 80% of cells, and no cell has an expected frequency < 1. If these assumptions are violated, consider Fisher's exact test instead.

Yates' continuity correction adjusts the chi-square formula for 2×2 tables to reduce overestimation of significance. It subtracts 0.5 from |O−E| before squaring, making the test more conservative.

Related Calculators