To calculate the degrees of freedom for a chi-square test, first create a contingency table and then determine the number of rows and columns that are in the chi-square test. Take the number of rows minus one and multiply that number by the number of columns minus one. The resulting figure is the degrees of freedom for the chi-square test.

**Set up a contingency table**Create a contingency table with two categorical variables: one represented in the rows and the other represented in the columns. When a researcher wants to compare the counts of more than one categorical variable, he creates a contingency table in which one variable represents the columns and another represents the rows. Categorical variables are variables that are not numbers. Gender, which is categorized as male or female, is an example of a categorical variable.

**Determine the number of rows and columns**Count the total number of rows in the contingency table. For example, if gender is a variable, there are two rows: one for male and one for female. Count the number of columns in the contingency table. Subtract one from the number of rows and one from the number of columns.

**Calculate the degrees of freedom**Multiply the two numbers that you generated in the second step. The result of this operation is the number of degrees of freedom.