Chi-Squared Test: How to Run It Online and Report It in APA7
The chi-squared (χ2) test compares observed counts with expected counts. The test of independence asks whether two categorical variables are associated; the goodness-of-fit test asks whether one variable follows an expected distribution.
What is Chi-Squared Test?
The chi-squared (χ2) test compares observed counts with expected counts. The test of independence asks whether two categorical variables are associated; the goodness-of-fit test asks whether one variable follows an expected distribution.
When to use it
Use the test of independence for a contingency table, for example whether group membership is associated with passing an exam, and goodness of fit to compare category counts with expected shares.
Example question: Is the type of teaching method associated with whether students pass?
Preparing your data
One row per participant and two categorical columns, or a table of counts. Each participant must fall into exactly one cell.
Example dataset (simulated; first rows of 180): id, method (Method A, B or C), outcome (Passed or Failed); one row per student.
| id | method | outcome |
|---|---|---|
| 1 | Method A | Passed |
| 2 | Method A | Failed |
| 3 | Method B | Passed |
| 4 | Method A | Failed |
| 5 | Method A | Failed |
| 6 | Method C | Passed |
Download the full example CSV to practise. If the tool asks for a different layout, follow the instructions on its page.
How to run it on StatFas
- Open the Chi-Squared Test tool. You do not need an account to run an analysis.
- Enter your data or upload your file, laid out as described in Preparing your data.
- Select your variables. Select the two categorical variables (rows and columns) for independence, or one variable and the expected proportions for goodness of fit.
- Choose any options the tool offers (for example the confidence level, a post hoc test or the error bar type) and run the analysis.
- Read the results on the page. Check the assumptions first, then the test statistic, the p-value and the effect size.
- To save your results, log in or create a free account. Every analysis stays free; the account is only needed to download.
Assumptions and checks
- Counts, not percentages or means, are analysed.
- Each observation is independent and counted once.
- Expected counts should be at least 5 in about 80% of cells and no expected count below 1. Otherwise combine categories or use Fisher's exact test (for 2 × 2 tables).
- Categories are mutually exclusive.
Key numbers to look at
- Observed and expected counts in each cell.
- χ2(df), N and p with df = (rows − 1) × (columns − 1).
- Effect size: φ for 2 × 2 tables, Cramér's V for larger tables.
- Standardised residuals showing which cells differ from expectation.
Effect size
Cramér's V (where df* is the smaller of rows − 1 and columns − 1): for df* = 1 about .10 small, .30 medium, .50 large; for df* = 2 about .07, .21, .35. The thresholds fall as tables get larger.
Benchmarks such as small, medium and large are conventions (Cohen, 1988), not rules. Interpret size in the context of your field.
Reporting Chi-Squared Test in APA7 style
Template
Worked example (simulated data)
The numbers below were computed from the example CSV above, so you can reproduce them. They illustrate the format and are not real findings.
| Method | Passed | Failed | % passed |
|---|---|---|---|
| Method A | 36 | 24 | 60.0 |
| Method B | 40 | 17 | 70.2 |
| Method C | 51 | 12 | 81.0 |
APA7 reminders: italicise statistical symbols (M, SD, t, F, p, r), report exact p-values to two or three decimals (use p < .001 for very small values), omit the leading zero for values that cannot exceed 1 (.45, not 0.45), and put degrees of freedom in parentheses. See the APA7 cheat sheet.
Common mistakes
- Running the test on percentages instead of counts.
- Ignoring small expected counts.
- Treating repeated measurements on the same people as independent observations (use McNemar's test).
Related analyses and alternatives
- Binomial Test: One two-category variable against an expected proportion.
- Logistic Regression: To model a yes/no outcome with several predictors.
- Frequency Analysis: To produce the counts first.
Not sure which analysis you need? Use the test chooser.
Frequently asked questions
What does a significant chi-squared test tell me?
That the two variables are associated, but not how strongly. Use Cramér's V and the residuals to see the strength and where the difference is.
What if some expected counts are below 5?
Combine categories if that makes sense, or use Fisher's exact test for a 2 × 2 table.
References
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). https://doi.org/10.1037/0000165-000
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
This guide is for learning and for preparing results for your own reports. You remain responsible for choosing an appropriate analysis, checking its assumptions and interpreting the results. Follow the formatting rules of your journal or institution where they differ from APA7.