Chi-square test
A chi-square test is a statistical hypothesis test that uses a chi-square-distributed statistic to evaluate hypotheses about categorical data, goodness of fit, or variance.
Statistics Slam Dunk
A chi-square test is a statistical test based on a chi-square-distributed statistic for assessing categorical-data relationships or distributional differences.
- How it is used
- Tests whether categorical variables such as prior rest and game outcomes are related.
- How deep it goes
- Defines independence hypotheses and p-value decisions, then demonstrates running chisq.test() on a contingency table.
- Examples
- Uses NBA days off versus wins and losses, survey sentiment versus marital status, political beliefs, and restaurant customer counts.
- What you can do after
- Apply it via base R’s chisq.test() to assess categorical relationships from a contingency table.
Effective Data Analysis
A chi-square test is a statistical test that evaluates categorical data by comparing observed frequencies with frequencies expected under a specified hypothesis.
- How it is used
- Uses categorical comparisons when both independent and dependent variables are categorical.
- How deep it goes
- Explains test variants, observed-versus-expected frequencies, contingency tables, calculations, and pairwise follow-up comparisons.
- Examples
- Demonstrates recommender versions, countries, user clicks, expected-frequency tables, Python output, and an observed-versus-expected heatmap.
- What you can do after
- Apply it via SciPy to compare categorical frequencies and inspect expected counts, p-values, and cell-level differences.
Statistics Every Programmer Needs
A chi-square test is a statistical hypothesis test that compares observed categorical counts with expected counts to assess whether their discrepancy is statistically significant.
- How it is used
- Tests whether observed leading-digit counts conform to Benford’s law for anomaly detection and statistical validation.
- How deep it goes
- Derives expected counts, the chi-square statistic, degrees of freedom, and p-value interpretation, while requiring sufficient records.
- Examples
- Uses leading digits in world population counts, with tabulated observed counts, expected counts, and category contributions.
- What you can do after
- Diagnose whether categorical counts significantly depart from an expected distribution using Python’s SciPy implementation.
Read how Statistics Every Programmer Needs explains chi-square test →
What to know first
- categorical dataCategorical data consists of values representing membership in discrete categories rather than measured numerical magnitudes.
- continuous dataContinuous data consists of numerical values that can vary across a range with arbitrarily fine precision.
- hypothesis testingHypothesis testing is a formal statistical procedure for evaluating evidence from observed data about a specified hypothesis, often a null hypothesis.
- p-valueA p-value is the probability, assuming a specified null hypothesis, of obtaining a test statistic or result at least as extreme as the observed one.
Related concepts
- hypothesis testingkind of · Hypothesis testing is a formal statistical procedure for evaluating evidence from observed data about a specified hypothesis, often a null hypothesis.
- non-parametric testkind of · A non-parametric test is a statistical test that evaluates evidence without requiring a specified parametric distributional form for the data.
- categorical datauses · Categorical data consists of values representing membership in discrete categories rather than measured numerical magnitudes.
- contingency tableuses · A contingency table is a tabular summary of counts or other measures for combinations of categories from two or more categorical variables.
- Cramer's Vcontrasts with · Cramer's V is a normalized, directionless measure of association strength between categorical variables in a contingency table, ranging from 0 to 1.
Questions about chi-square test
What is chi-square test?
A chi-square test is a statistical hypothesis test that uses a chi-square-distributed statistic to evaluate hypotheses about categorical data, goodness of fit, or variance.
Which Manning books explain chi-square test?
Statistics Slam Dunk, Effective Data Analysis and Statistics Every Programmer Needs.
What should I know before learning chi-square test?
Manning books that teach chi-square test usually introduce categorical data, continuous data, hypothesis testing and p-value first.
What is the difference between chi-square test and Cramer's V?
A chi-square test is a statistical hypothesis test that uses a chi-square-distributed statistic to evaluate hypotheses about categorical data, goodness of fit, or variance. Cramer's V is a normalized, directionless measure of association strength between categorical variables in a contingency table, ranging from 0 to 1.
What is chi-square test a kind of?
Chi-square test is a kind of hypothesis testing. Hypothesis testing is a formal statistical procedure for evaluating evidence from observed data about a specified hypothesis, often a null hypothesis.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


