Chisquared 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 by clicking on the dropdown button in the righthand column. To practice with a specific method click the button at the bottom row of the table
Chisquared test for the relationship between two categorical variables 


Independent /column variable  
One categorical with $I$ independent groups ($I \geqslant 2$)  
Dependent /row variable  
One categorical with $J$ independent groups ($J \geqslant 2$)  
Null hypothesis  
H_{0}: 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:
 
Alternative hypothesis  
H_{1}: 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:
 
Assumptions  
 
Test statistic  
$X^2 = \sum{\frac{(\mbox{observed cell count}  \mbox{expected cell count})^2}{\mbox{expected cell count}}}$
where 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  
Sampling distribution of $X^2$ if H_{0} were true  
Approximately the chisquared distribution with $(I  1) \times (J  1)$ degrees of freedom  
Significant?  
 
Example context  
Is there an association between economic class and gender? Is the distribution of economic class different between men and women?  
SPSS  
Analyze > Descriptive Statistics > Crosstabs...
 
Jamovi  
Frequencies > Independent Samples  $\chi^2$ test of association
 
Practice questions  