This article describes how to perform a chi-square test of independence on a crosstab table to see whether there is a relationship between two categorical variables. It tests to see if knowledge of the value of an observation in one categorical variable can be used to predict the likely values of the other variable.
Requirements
A Displayr document containing categorical variables you would like to use in the chi-square test. Although it is not requested, normally you would perform the crosstab first and then the chi-square test if you suspect that there is a relationship between the two variables. In this example, we will be examining the relationship between What is your favorite movie genre? and What is your sex?
Method
- Go to Anything > Advanced Analysis Test > Chi-Square Test of Independence
- Under Inputs > Variable 1, select the nominal or ordinal variable containing the data that is to be predicted.
- Under Inputs > Variable 2, select the nominal or ordinal variable containing the data this you are using as the predictor
- OPTIONAL: Select Variable names to display variable names in the output instead of the variable labels
- OPTIONAL: Select More decimal places to display more decimal places of precision in the output.
Next