Skip to content
Statistics

What is a chi-square test?

A test that compares observed counts with the counts expected under a null hypothesis: χ² = Σ (O − E)² / E. The test of independence checks whether two categorical variables are related; the goodness-of-fit test checks whether counts follow an expected distribution.

datasciencetrivia.com

Card 1 of 276. Answer: A test that compares observed counts with the counts expected under a null hypothesis: χ² = Σ (O − E)² / E. The test of independence checks whether two categorical variables are related; the goodness-of-fit test checks whether counts follow an expected distribution.

Created by santiviquez

About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.

The longer answer

Each cell contributes its squared gap between observed and expected counts, scaled by the expected count, and the total is compared with a chi-square distribution. For a test of independence on an r × c table, expected counts come from the row and column totals, and the degrees of freedom are (r − 1)(c − 1). Karl Pearson introduced the test in 1900.

Example: 200 users see each of two checkout pages; 30 convert on A and 50 on B. Overall 80 of 400 convert, so each page is expected to have 40 conversions and 160 non-conversions. χ² = 10²/40 + 10²/40 + 10²/160 + 10²/160 = 6.25 with 1 degree of freedom, so p ≈ 0.012. Many libraries apply Yates' continuity correction to 2 × 2 tables by default, which here gives 5.64 and p ≈ 0.018.

Interview follow-ups: the approximation needs expected counts of about 5 or more in each cell, otherwise use Fisher's exact test; a significant result says the variables are related, not how strongly, so report a measure such as Cramér's V; and for a 2 × 2 table without the correction, the statistic equals the square of the two-proportion z statistic.

All questions