Step by Step

Using our household database (HTS.household.lOregions.sav), let’s assume that you wonder if there are differences in the probability of walking between different housing types. The household data has a housing type variable (sf) having two categories— single family detached house (coded as 1) or not (0). The anywalk variable shows whether a given household made any walk trips in the survey day (coded as 1) or not (0). Both variables are categorical, having two groups.

The first step for any inferential statistical test is to ensure you are using the right test. In our example of anywalk trip and housing types, we can use the chi-square test because both variables are categorical. Also, the samples could be assumed as randomly selected, the categories don’t overlap (i.e., mutually exclusive), and the sample size is large enough across the whole categories.

Our null hypothesis would be that there is no difference in the proportion of occurrences in each category and so two variables—housing types and any walk trip—are not related. Then, our alternative hypothesis is the exact opposite, which is that there is a relationship. In other words, the probability that a household makes any walk trips varies by whether the household lives in single-family detached house or not.

A planner would expect a negative association: a walk trip probability decreases with single-family detached house residence.

The following paragraphs outline a step-by-step process for chi-square test in SPSS; which when followed, will provide the user a template for practical applications of the chi-square method (Figures 8.2 through 8.5).

  • 1. Go to “Analyze" —* “Descriptive Statistics” —* “Crosstabs”
  • 2. Add two variables to Row and Column respectively (e.g., sf to Row and anywalk to Column)
  • 3. Click “Statistics” button and make sure “Chi-square” and "Phi and Cramer’s V" test are checked
  • 4. Go to “Cells” button and check “Observed" and “Expected” in Counts box and check "Row” in Percentages box —* Click "Continue"
  • 5. Then click "OK." The results will appear.
Accessing Crosstabs in SPSS

Figure 8.2 Accessing Crosstabs in SPSS

Crosstabs Selection Menn

Figure 8.3 Crosstabs Selection Menn

In the cross tabulation, or contingency table, you can see observed and expected values of each cell (Table 8.3). In each cell, the observed count is not much different from the expected count. From the percentages in the table, you can see that lower percentage of households living in single-family detached house (20.0 percent) made anywalk trip, compared with those in other types of house did (23.8 percent).

In Table 8.4, you need to see the Pearson Chi-Square row. It presents high chi-square value (18.566) and that it is statistically significant (/><.001). At the bottom of the table, a caption “a” tells us that there is no concern of small cell sizes, which would otherwise suggest the Fisher’s Exact test.

You can see also the strength test results in Table 8.5. In this example, you would see the phi result because the contingency table is 2 x 2. For a larger table, you would look at the Cramer’s V result. The value is -0.037, which means relative low correlation measures, even for a statistically significant result (/><.001).

Now take a look at some specific examples from recent planning literature to see how chi-square has been used in academic research.

Crosstabs Statistics Selection Menu

Figure 8.4 Crosstabs Statistics Selection Menu

In R

Figures 8.6 and 8.7 show an example of a chi-square test in R. The script first presents a contingency table of housing types and anywalk variable (0 = no walking, 1 = walking) for counts and probabilities, respectively. Then, chisq.test function is used to run a test. Note that the chisq.test function uses Yates’ continuity correction as a default, generating the value of 18.333 in this case. If you want Pearson chi-square, you should add a parameter in your chisq.test code, “correct=FALSE,” which will give you a value of 18.566 in this example. The assocstats function in vcd package is then used to check symmetric measures for the chi-square test.

Crosstabs Cell Display Menu

Figure 8.5 Crosstabs Cell Display Menu

Table 8.3 A. Contingency Table of Chi-Square About Housing Types and Any Walk Trip

sf * anywalk cross tabulation

anywalk

Total

.00

1.00

sf

other

Count

1.951

610

2,561

Expected Count

2.030.4

530.6

2,561.0

% within st

76.2%

23.8%

100.0%

single family detached

Count

8.572

2,140

10,712

Expected Count

8,492.6

2,219.4

10,712.0

% within sf

80.0%

20.0%

100.0%

Total

Count

10,523

2,750

13,273

Expected Count

10,523.0

2,750.0

13,273.0

% within sf

79.3%

20.7%

100.0%

Table 8.4 Chi-Square Test Significance About Housing Types and Any Walk Trip

Value

df

Asymp. Sig. (2-sided)

Exact Sig. (2-sided)

Exact Sig. ( 1-sided)

Pearson chi-square

18.566“

1

.000

.000

.000

Continuity correction11

18.333

1

.000

Likelihood ratio

18.088

1

.000

Fisher’s exact test

Linear-by-linear association

18.565

1

.000

N of valid cases

13,273

a 0 cells (.0 percent) have expected count less than five. The minimum expected count is 530.61. b Computed only for a 2 x 2 table

Table 8.5 Symmetric Measures for the Chi-Square Test

Value

Approx. Sig.

Nominal by nominal

Phi

-.037

.000

Cramer’s V

.037

.000

N of valid cases

13,273

 
Source