Statistical Methods

Chi-Square Test in Medical Research: Guide and Example

Learn how to test associations between categorical variables and report them accurately.

What does a chi-square test answer?

The Pearson chi-square test of independence examines whether the distribution of one categorical variable differs across categories of another. It is commonly used for independent observations in cross-sectional, case-control and cohort datasets. It does not measure the strength or clinical importance of an association by itself, and it does not establish causality.

Example: treatment group and improvement

Imagine 100 independent participants. In Group A, 35 of 50 improved and 15 did not; in Group B, 25 of 50 improved and 25 did not. The table is:

OutcomeGroup AGroup B
Improved3525
Not improved1525

Improvement was 70% in Group A and 50% in Group B: a 20 percentage-point absolute difference. A chi-square test can assess whether the observed counts are consistent with independence, but the result should be accompanied by an appropriate effect measure and confidence interval. These are synthetic teaching data; do not present them as observed clinical results.

Assumptions and alternatives

The independent observations assumption is essential. Inspect expected frequencies, not only observed frequencies. When a table is sparse, an exact method such as Fisher's exact test may be more suitable. For paired binary outcomes, McNemar's test is commonly considered instead. When controlling for confounders, use a suitable regression model rather than relying on multiple bivariate tests.

Reporting checklist

Report group denominators, row or column percentages with clearly stated denominators, the exact test used, test statistic/degrees of freedom when appropriate, p-value, effect measure, confidence interval and missing values. Avoid writing p = 0.000; use p < 0.001 if warranted.

Use ResearchTry: Import an Excel or CSV master chart, validate category coding, and review generated crosstabulations in the Statistical Analysis tool.

Frequently asked questions

When should Fisher’s exact test be considered?

For small or sparse contingency tables where asymptotic chi-square approximations may be unreliable. The precise approach depends on table structure and study design.

Does chi-square establish causation?

No. It tests evidence against an independence model; confounding, bias and causal design questions remain.

Further reading and primary guidance

Figures and numbers on this page are illustrative examples only and do not contain real patient data. Always follow your institution's guidelines and your guide's advice.

Ready to put this into practice in ResearchTry?

Explore Statistical Analysis

Related reading