Chi-square test calculator and crosstab APA table
A chi-square test tells you whether two categorical variables are associated, and it is valid only when no more than 20% of cells have an expected count below 5 and none is below 1 (Cochran, 1954). Pick two variables and the tool builds the crosstab as SPSS Crosstabs does, checks the expected counts, switches to Fisher's exact test when a 2×2 table has cells that are too small, and writes the results paragraph.
- Upload an Excel or CSV export of your data (one row per respondent), or try the sample data.
- Choose the row variable (usually the independent variable), the column variable and the percentages to show.
- Run the test, then download the Word file or copy the tables and text.
Saved to the results chapter report builder in this browser.
Pearson chi-square, Yates’ continuity correction (2×2 tables), the likelihood ratio and Fisher’s exact test (2×2 tables, two-sided) are computed as in SPSS Crosstabs and R’s chisq.test and fisher.test. Check against SPSS the first time you use it.Was this tool useful? Feedback / report a bug (by email; please do not paste real data).
When to use a chi-square test of independence
- Both variables are grouping variables: nominal, or ordinal with only a few levels. Typical examples are gender, year of study, field of study, or whether someone uses a service. If you want to compare the mean of a numeric variable across groups, use a t-test or ANOVA in the survey data analysis tool instead.
- Each person appears in exactly one cell of the table, so the observations are independent. Two measurements on the same people (before and after, for instance) call for McNemar's test, not a chi-square test.
Chi-square or Fisher's exact test?
The Pearson chi-square is appropriate when no more than 20% of cells have an expected count below 5 and no cell has an expected count below 1 (Cochran, 1954). The test table reports how many cells break this rule. For a 2×2 table that fails the condition, report Fisher's exact test; the tool makes this choice for you and says so in the paragraph. For larger tables, merge sparse categories (for example Year 1 with Year 2) and run the test again.
Yates' continuity correction applies only to 2×2 tables and is usually too conservative; many texts recommend reporting the Pearson chi-square or Fisher's exact test instead.
How to read the output
- p < .05 means the two variables are associated: the distribution of the column variable differs across the groups of the row variable.
- Cramér's V measures the strength of the association on a 0 to 1 scale. Cohen's (1988) benchmarks depend on the table size: for a table with 2 rows or 2 columns, .10, .30 and .50 mark small, medium and large effects; for a 3 × k table the benchmarks are .07, .21 and .35.
- Adjusted standardized residuals (the Adjusted Residual in SPSS) show which cells drive the association. A cell with |z| > 1.96 holds more or fewer cases than expected at the 5% level, and the tool prints it in bold.
- Row or column percentages: row percentages compare the groups of the row variable, which is what you usually want when the row variable is the independent variable.
Reporting it in APA 7 style
Give the chi-square with its degrees of freedom and sample size, the exact p value without a leading zero, and the effect size, followed by a sentence on which groups differ. A template: “There was a statistically significant association between year of study and recruitment channel, χ²(4, N = 240) = value, p = value, Cramér's V = value.” Present the crosstab as a table with counts and percentages, and note in the table note which percentages are shown. The tool writes this paragraph from your own results, adds the references, and saves the section to the results chapter report builder.
Worked example: the built-in sample data
Click “Use sample data” to load 240 student responses with gender, year of study (Years 2 to 4), the main channel used to recruit survey respondents (Facebook groups, friends and classmates, messaging apps) and whether the student paid an incentive. Crossing year of study with recruitment channel gives a 3 × 3 table, so the tool reports the Pearson chi-square, the likelihood ratio and Cramér's V with the 3 × k benchmarks; crossing gender with paying an incentive gives a 2 × 2 table, where you also see Yates' correction, phi and Fisher's exact test.
FAQ
Can I use the chi-square test with a small sample?
Only if the expected counts meet Cochran's (1954) rule. With a 2×2 table that fails it, report Fisher's exact test; with a larger table, merge categories with few cases.
Which variable goes in the rows?
Put the independent variable (the grouping you compare, such as year of study) in the rows and show row percentages. The chi-square value itself is the same either way.
My test is significant. Which groups differ?
Look at the cells in bold: their adjusted residuals exceed 1.96 in absolute value. The paragraph names up to three cells where a group chose a category more often than expected.
I have a yes/no outcome and several predictors. What now?
A chi-square test looks at one pair of variables at a time. To estimate the effect of several predictors together, use binary logistic regression.
References
- Cochran, W. G. (1954). Some methods for strengthening the common χ² tests. Biometrics, 10(4), 417–451. https://doi.org/10.2307/3001616
- Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
- Fisher, R. A. (1922). On the interpretation of χ² from contingency tables, and the calculation of P. Journal of the Royal Statistical Society, 85(1), 87–94. https://doi.org/10.2307/2340521
One of the free research tools of Research Corner.