# Performing Chi-squared tests for 2 categorical variables (the dependent variable has 4 categories) and looking at statistical difference?

#### gunhero123

##### New Member
Hey guys,

I have my SPSS dataset for my research all set and ready to analyse.
I want to perform a chi-squared test to look at the relationship between 2 categorical variables.
e.g. relationship between headache and different outcomes (4 subcategories? i.e. benign, progressive, disability, death)

I have tried to do this via crosstabs/chi-squared test on SPSS and I do get a significance of p<0.05 which is reassuring however is there any way I can find which category in the different outcome variable is statistically different?

I've been trying to search for a while...

Thanks so much!

#### Karabiner

##### TS Contributor
One approach could be to inspect the standardized adjusted cell residuals.

Or, you perform pairwise comparisons (select only 2 groups at a time for Chi2-testing).
By the way, could the dependent variable perhaps considered as ordinal scaled?

With kind regards

Karabiner

#### gunhero123

##### New Member
The dependent variable in this case may (I might need to ask my supervisor) be considered on the ordinal scale. How would this change interpretation?

In this case, the adjusted residuals for the 4 groups are above. How would I interpret this? Would it be safe to say since group 4 is furthest away then it is likely the one contributing to the significant difference in the chi-squared test?

Thank you

#### Karabiner

##### TS Contributor
The dependent variable in this case may (I might need to ask my supervisor) be considered on the ordinal scale.
In that case, you could use Kruskal-Wallis H-test as a global test (if your group
variable has more than 2 levels) , and U-tests for pairwise comparisons. If the
data are ordinal, then treating them as categorical and performing Chi² could
be a waste of statistical information.

In this case, the adjusted residuals for the 4 groups are above. How would I interpret this?
I am not sure what that represents. I thought you had at least 2*4=8 cells,
or even more?

Anyway, standardized residuals > 1.96 or < -1.96 indicate a deviation above
the chance level, from what is expected under the Null hypothesis (z value
> |1.96| is analogous to the 5% area of rejection in a statistical significance
test). In your example, no such marked deviation was seen.

With kind regards

Karabiner

#### gunhero123

##### New Member
In that case, you could use Kruskal-Wallis H-test as a global test (if your group
variable has more than 2 levels) , and U-tests for pairwise comparisons. If the
data are ordinal, then treating them as categorical and performing Chi² could
be a waste of statistical information.

I am not sure what that represents. I thought you had at least 2*4=8 cells,
or even more?

Anyway, standardized residuals > 1.96 or < -1.96 indicate a deviation above
the chance level, from what is expected under the Null hypothesis (z value
> |1.96| is analogous to the 5% area of rejection in a statistical significance
test). In your example, no such marked deviation was seen.

With kind regards

Karabiner
Thanks a lot for your reply. I think my data is more suited for nominal so a chi-squared is suitable.

Regarding my data, I'll post an image.

For the >1.96 etc, would I be looking at the standardised or adjusted residual?

#### gunhero123

##### New Member
This is the data crosstabs I generated.

The chi-squared value is p<0.05, suggesting statistical significance but looking from this based on hwat you've said I can't work out which group is different?

EDIT: removed file.

Last edited:

#### Karabiner

##### TS Contributor
You will find it discussed here and also here.

With kind regards

Karabiner