Chi-squared test for the relationship between two categorical variables - overview
This page offers structured overviews of one or more selected methods. Add additional methods for comparisons (max. of 3) by clicking on the dropdown button in the right-hand column. To practice with a specific method click the button at the bottom row of the table
Chi-squared test for the relationship between two categorical variables | Kruskal-Wallis test |
|
---|---|---|
Independent /column variable | Independent/grouping variable | |
One categorical with $I$ independent groups ($I \geqslant 2$) | One categorical with $I$ independent groups ($I \geqslant 2$) | |
Dependent /row variable | Dependent variable | |
One categorical with $J$ independent groups ($J \geqslant 2$) | One of ordinal level | |
Null hypothesis | Null hypothesis | |
H0: there is no association between the row and column variable More precisely, if there are $I$ independent random samples of size $n_i$ from each of $I$ populations, defined by the independent variable:
| If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
Formulation 1:
| |
Alternative hypothesis | Alternative hypothesis | |
H1: there is an association between the row and column variable More precisely, if there are $I$ independent random samples of size $n_i$ from each of $I$ populations, defined by the independent variable:
| If the dependent variable is measured on a continuous scale and the shape of the distribution of the dependent variable is the same in all $I$ populations:
Formulation 1:
| |
Assumptions | Assumptions | |
|
| |
Test statistic | Test statistic | |
$X^2 = \sum{\frac{(\mbox{observed cell count} - \mbox{expected cell count})^2}{\mbox{expected cell count}}}$
Here for each cell, the expected cell count = $\dfrac{\mbox{row total} \times \mbox{column total}}{\mbox{total sample size}}$, the observed cell count is the observed sample count in that same cell, and the sum is over all $I \times J$ cells. | $H = \dfrac{12}{N (N + 1)} \sum \dfrac{R^2_i}{n_i} - 3(N + 1)$ | |
Sampling distribution of $X^2$ if H0 were true | Sampling distribution of $H$ if H0 were true | |
Approximately the chi-squared distribution with $(I - 1) \times (J - 1)$ degrees of freedom | For large samples, approximately the chi-squared distribution with $I - 1$ degrees of freedom. For small samples, the exact distribution of $H$ should be used. | |
Significant? | Significant? | |
| For large samples, the table with critical $X^2$ values can be used. If we denote $X^2 = H$:
| |
Example context | Example context | |
Is there an association between economic class and gender? Is the distribution of economic class different between men and women? | Do people from different religions tend to score differently on social economic status? | |
SPSS | SPSS | |
Analyze > Descriptive Statistics > Crosstabs...
| Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples...
| |
Jamovi | Jamovi | |
Frequencies > Independent Samples - $\chi^2$ test of association
| ANOVA > One Way ANOVA - Kruskal-Wallis
| |
Practice questions | Practice questions | |