Inference for Two Categorical Variables: Chi-Square
Build Expected Counts From Margins, Then Test Independence
For a two-way table, the independence model gives expected count = row total × column total / grand total. Expected counts are model quantities, not the observed counts sorted differently.
The statistic χ² adds (observed − expected)² / expected across cells. For an r by c table, degrees of freedom are (r−1)(c−1). Large discrepancies relative to expected counts give larger contributions.
A small p-value is evidence against population independence under the sampling and approximation conditions. It does not establish causal direction, mechanism, or absence of confounding.
For a 4 × 2 contingency table, what are the degrees of freedom for a chi-square test of independence?
A chi-square independence test gives p = 0.004. What conclusion is justified at α = 0.05?