# Test relationship between two categorical variables the chi square

### Lesson 9 - Identifying Relationships Between Two Variables | STAT

Identify the correct types of variables for use with a chi-square test of independence. • Explain the difference between parametric and nonparametric statistics. Note. Use the chi-square test to test the null hypothesis: H0: there is no relationship between two categorical variables when you have a two-way table from one. How to perform a chi-square test of association using SPSS. test of association, is used to discover if there is a relationship between two categorical variables.

In the case where both variables are categorical and binary, we will show illustrate the connection between the Chi-square test and the z-test of two independent proportions. Going forward, keep in mind that this Chi-square test, when significant, only provides statistical evidence of an association or relationship between the two categorical variables.

Do NOT confuse this result with correlation which refers to a linear relationship.

The primary method for displaying the summarization of categorical variables is called a contingency table.

When we have two measurements on our subjects that are both the categorical, the contigency table is sometimes referred to as a two-way table.

## Two-Way Tables and the Chi-Square Test

This is terminology is derived because the summarized table consists of rows and columns i. Therefore, until we have evidence to suggest that they are we must assume that they are not.

This is the motivation behind the hypothesis for the Chi-square Test of Independence: In the population, the two categorical variables are independent. In the population, two categorical variables are dependent. The are several ways to phrase these hypotheses.

### Data Analysis - Chi-squared test for nominal (categorical) data

Instead of using the words "independent" and "dependent" one could say "there is no relationship between the two categorical variables" versus "there is a relationship between the two categorical variables". The important part is that the null hypothesis refers to the two categorical variables not being related while the alternative is trying to show that they are related.

A two-way table separating the students by grade and by choice of most important factor is shown below: Grade Goals 4 5 6 Total Grades 49 50 69 Popular 24 36 38 98 Sports 19 22 28 69 Total 92 To investigate possible differences among the students' choices by grade, it is useful to compute the column percentages for each choice, as follows: Grade Goals 4 5 6 Grades 53 46 51 Popular 26 33 28 Sports 21 20 21 Total There is error in the second column the percentages sum to 99, not due to rounding.

From the appearance of the column percentages, it does not appear that there is much of a variation in preference across the three grades.

A and Dummer, G. The chi-square test provides a method for testing the association between the row and column variables in a two-way table.

## Lesson 9 - Identifying Relationships Between Two Variables

The null hypothesis H0 assumes that there is no association between the variables in other words, one variable does not vary according to the other variablewhile the alternative hypothesis Ha claims that some association does exist. The alternative hypothesis does not specify the type of association, so close attention to the data is required to interpret the information provided by the test. The chi-square test is based on a test statistic that measures the divergence of the observed data from the values that would be expected under the null hypothesis of no association.