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

Please note these steps require a **Displayr **license.

A Displayr document containing categorical variables you would like to use in the chi-square test. Although it is not required, normally you would perform the crosstab first and then the chi-square test if you suspect there is a relationship between the two variables. In this example, we will examine 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
**Data > Variable 1**, select the nominal or ordinal variable containing the data that is to be predicted. - Under
**Data > Variable 2**, select the nominal or ordinal variable containing the data that 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.