M1-077M1: Mathematics & Statistics FundamentalsHypothesis TestingMedium
⚡Flashcard Drill➔Mastery:

Explain the Three Primary Statistical Applications of the Chi-Square Test

🎯 Active Recall Self-Check (Draft First, Verify After)
Login-free practice tracker: recall core answer, audit pitfalls, and log review status.
Step 1 · Draft your concise answer & assumptions
Step 2 · Check Pitfalls & Follow-up Inquiries
Next: M1-078 →
📐 Mathematical Definition
χ2=∑i(Oi−Ei)2Ei\chi^2=\sum_i\frac{(O_i-E_i)^2}{E_i}
⚡ One-Sentence Core Answer
The Chi-Square test evaluates (1) Goodness-of-Fit (matching empirical counts to expected theoretical distributions), (2) Test of Independence (evaluating association between two categorical variables in contingency tables), and (3) Test of Homogeneity (comparing categorical proportions across multiple independent sub-populations).

📌 Key Takeaways

  • •
    Unified Test Statistic: χ2=∑i(Oi−Ei)2Ei∼χν2\chi^2 = \sum_{i} \frac{(O_i - E_i)^2}{E_i} \sim \chi^2_\nu.
  • •
    Goodness-of-Fit: Tests if observed counts match a known distribution (e.g. SRM check in A/B testing has df=k−1\text{df} = k - 1).
  • •
    Contingency Table Independence: Evaluates r×cr\times c matrix independence: Eij=RiCjNE_{ij} = \frac{R_i C_j}{N} with df=(r−1)(c−1)\text{df} = (r-1)(c-1).
  • •
    Precondition: Expected cell count Ei≥5E_i \ge 5 in at least 80% of cells (otherwise Fisher's Exact Test must be used).

📐 Mathematical Derivations

Derivation of the Chi-Square statistic: Let observed counts in kk categories follow a Multinomial distribution Multinomial(N,p1,…,pk)\text{Multinomial}(N, p_1, \dots, p_k). By the Multivariate Central Limit Theorem, the normalized vector Oi−NpiNpi\frac{O_i - N p_i}{\sqrt{N p_i}} converges to a singular multivariate normal distribution with rank k−1k-1 (due to constraint ∑Oi=N\sum O_i = N). The sum of squares of these standardized normal components is ∑i=1k(Oi−NpiNpi)2=∑i=1k(Oi−Ei)2Ei∼χk−12\sum_{i=1}^k \left(\frac{O_i - N p_i}{\sqrt{N p_i}}\right)^2 = \sum_{i=1}^k \frac{(O_i - E_i)^2}{E_i} \sim \chi^2_{k-1}. In a contingency table with rr rows and cc columns, estimating expected frequencies Eij=Np^i⋅p^⋅jE_{ij} = N \hat{p}_{i\cdot} \hat{p}_{\cdot j} consumes (r−1)+(c−1)(r-1) + (c-1) parameters, leaving degrees of freedom df=(rc−1)−(r−1)−(c−1)=(r−1)(c−1)\text{df} = (rc - 1) - (r-1) - (c-1) = (r-1)(c-1).

🏭 Production Trade-offs

Industrial uses: (1) SRM Sanity Check: Flagging sample ratio mismatches in A/B testing uses goodness-of-fit. (2) Feature Selection: χ2\chi^2 feature selection tests whether categorical features (e.g. Device type, search query intent) are independent of class label YY, ranking features by test statistic magnitude.
⚠️ Common Interview Pitfalls
  • ✕
    Applying the Chi-Square test when expected cell counts are tiny (Ei<5E_i < 5), inflating Type I error.
  • ✕
    Confusing the Test of Independence (single sample cross-classified) with Test of Homogeneity (pre-determined fixed row totals across independent samples).
🎯 Interviewer Follow-up Inquiries
  • ?
    Why does Fisher's Exact Test supersede Chi-Square when cell counts are small?
  • ?
    How does Cramér's V standardize the Chi-Square statistic into an effect size in [0,1][0, 1]?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
📚

Associated Knowledge Base Guides & Mindmaps

← PreviousM1-076: Explain the Decision Criteria Between Two-Sample t-Test and z-Test📋 Back to BankNext →M1-078: Explain the Wilcoxon Rank-Sum Test and When Non-Parametric Rank Tests Should Be Chosen