To test the association between two categorical variables (i.e., nominal or ordinal) X1 and X2 for the same population
Note: The variables X1 and X2 should be nominal or ordinal level.
[Comment: I usually use chi-squared test only when both variables are nominal, because even if the variables are ordinal, the chi-squared test will still treat them as nominal, thus losing information about the ranks. Therefore, if one of the variables is ordinal, I would use non-parametric test instead. If both of them are ordinal, I would use the Spearman rank correlation instead.]
H0: There is no association between X1 and X2.
H1: There is association between X1 and X2.
Note: There is no one-tailed version of the chi-squared test.
You want to know if there is any association between gender (nominal) and income level (ordinal) in the population. Here gender is the independent variable, while income level is the dependent variable.
H0: There is no association between gender and income level.
H1: There is association between gender and income level.
Analyze -> Descriptive Statistics -> Crosstabs -> Select the variables into rows and columns -> Select other group variables into Layers if needed -> Click Statistics button and check Chi-square -> Select other tests if needed -> Click Cells button and check Expected under Counts, and Compare column proportions with Adjust p-values (Bonferroni method) for post hoc test (if needed) -> Check the percentages if needed
The subscripts (a, b, etc.) (if any) in the cross-tabulation table show which frequencies are considered identical to one another.
The p-values of the chi-squared tests are found in the Chi-Square Tests table. Small enough p-values reject the null hypothesis that the variables are independent.
Analyses->Frequencies->Independent Samples:
Put the independent variable in the Rows and dependent variable in the Columns.
Click Cells and optionally check Observed and Expected counts, as well as percentages.
Inspect the cross-tabulation (contingency tables) in the output.
Under Statistics->Tests, choose chi-squared test or other tests.
The chi-squared test is considered invalid if many of the cells (e.g., a rule-of-thumb is that there are more than 20% of them) have expected frequency less than 5. SPSS will warn about that in the output. If you use Jamovi you need to check it manually.
This criterion makes sense because the chi-squared test is essentially testing the frequency distribution of the dependent variable at different values of the independent variable. If many of the cells have small expected frequency, then it could be difficult to conclude about any difference in the distributions.
You can do the following if your chi-squared test is invalid:
Consider dropping or merging some of the groups by recode (e.g., 1->1, 2->1, 3->1, 4->2, 5->3 will merge groups 1, 2, and 3, reducing the total number of groups from five to three) and retry the chi-squared test. Repeat until the test is valid; or
If the table is 2x2 (or reduced to 2x2), then use the p-values for Fisher’s exact test instead. This test will be conducted automatically in SPSS in case of 2x2 table. In Jamovi, you can select it manually under the Statistics options. This test is not affected by the small expected count issue but it only works for 2x2 tables; or
If the dependent variable is ordinal, use non-parametric tests instead; or
If both variables are ordinal, use Spearman rank correlation instead.
If p is NOT <0.05 (or other significant levels), we take H0 as true, i.e., there is no association between X1 and X2.
If p<0.05 (or other significant levels), we take H1 as true, i.e., there is association between X1 and X2.
Name of the test being used (chi-squared test)
The test variables
The chi-squared statistic
The p-value
Your conclusion of the test
Elaboration of the result in your research context