One way to visualize this is using clustered bar charts. Before the Testīefore we test for "association", it is helpful to understand what an "association" and a "lack of association" between two categorical variables looks like. Suppose we want to test for an association between smoking behavior (nonsmoker, current smoker, or past smoker) and gender (male or female) using a Chi-Square Test of Independence (we'll use α = 0.05). There were three answer choices: Nonsmoker, Past smoker, and Current smoker. In the sample dataset, respondents were asked their gender and whether or not they were a cigarette smoker. This option is enabled by default.Ģ Expected: The expected number of observations for that cell (see the test statistic formula).ģ Unstandardized Residuals: The "residual" value, computed as observed minus expected.į Format: Opens the Crosstabs: Table Format window, which specifies how the rows of the table are sorted. They show the number of observations for a given combination of the row and column categories.) There are three options in this window that are useful (but optional) when performing a Chi-Square Test of Independence:ġ Observed: The actual number of observations for a given cell. (Note: in a crosstab, the cells are the inner sections of the table. To run the Chi-Square Test of Independence, make sure that the Chi-square box is checked.Į Cells: Opens the Crosstabs: Cell Display window, which controls which output is displayed in each cell of the crosstab. (This is not equivalent to testing for a three-way association, or testing for an association between the row and column variable after controlling for the layer variable.)ĭ Statistics: Opens the Crosstabs: Statistics window, which contains fifteen different inferential statistics for comparing categorical variables. If you have turned on the chi-square test results and have specified a layer variable, SPSS will subset the data with respect to the categories of the layer variable, then run chi-square tests between the row and column variables. Additionally, if you include a layer variable, chi-square tests will be run for each pair of row and column variables within each level of the layer variable.Ĭ Layer: An optional "stratification" variable. A chi-square test will be produced for each table. The same is true if you have one column variable and two or more row variables, or if you have multiple row and column variables. You must enter at least one Column variable.Īlso note that if you specify one row variable and two or more column variables, SPSS will print crosstabs for each pairing of the row variable with the column variables. You must enter at least one Row variable.ī Column(s): One or more variables to use in the columns of the crosstab(s). To create a crosstab and perform a chi-square test of independence, click Analyze > Descriptive Statistics > Crosstabs.Ī Row(s): One or more variables to use in the rows of the crosstab(s). Recall that the Crosstabs procedure creates a contingency table or two-way table, which summarizes the distribution of two categorical variables. In SPSS, the Chi-Square Test of Independence is an option within the Crosstabs procedure.
That is, each row represents an observation from a unique subject.
Cases represent subjects, and each subject appears once in the dataset.Your data may be formatted in either of the following ways: If you have the raw data (each row is a subject): The categorical variables must include at least two groups. At minimum, your data should include two categorical variables (represented in columns) that will be used in the analysis.
The format of the data will determine how to proceed with running the Chi-Square Test of Independence. There are two different ways in which your data may be set up initially.