Chapter 18
1. Introduction to chi-square tests and one-variable analysis
This section introduces the foundational concepts of the chi-square (χ2) test, focusing initially on its application to categorical variables, defining expected frequencies under the null hypothesis, and illustrating its use in simple one-row (goodness-of-fit) analyses before moving toward more complex contingency tables.
1.1 Overview and application of chi-square tests
The chi-square (χ2) test is exclusively concerned with categorical variables, which produce nominal data summarized as frequencies or counts by category or level. This statistical tool is versatile, applicable in several scenarios:
- Analyzing a simple division of one variable into two frequency categories.
- Testing for an association between two categorical variables using cross-tabulation tables.
- Serving as a goodness-of-fit test to assess if an observed frequency distribution closely matches a theoretical distribution (e.g., comparing observed degree classifications to national averages).
The data requirements for using chi-square tests are strict:
- Data must be in the form of frequencies (counts), not ratios, means, or proportions.
- Each case must belong exclusively to one category; subjects cannot be counted in multiple cells of the data table.
Tip: Chi-square tests are used when looking for an association or a difference in proportions between two categorical variables in a between-groups design. The Greek letter χ (chi) is pronounced 'kye'.
1.2 Categorical data presentation: Cross-tabulation
When data involves two categorical variables, the observed frequencies are presented in a cross-tabulation (cross-tabs) table. The values within the cells of these tables are the raw counts of cases observed in that specific combination of categories.
An example involves analyzing the relationship between the age of a car (New vs. Old) and driver behavior at a pedestrian crossing (Stopped vs. Did not stop). The hypothesis might be that drivers of newer cars conform more often, perhaps due to being older or more experienced.
The data for this example illustrates the need for statistical testing to determine if observed differences in proportions (e.g., stopping behavior between new and old car drivers) are statistically significant or merely due to chance.

Another example involves observing whether people dropped litter based on the existing amount of litter present (categorized as 0/1 piece, 2/4 pieces, or 8/16 pieces). Since the dependent variable (dropped litter or didn't drop litter) was categorical, the independent variable's measured values were reduced to three categories for analysis 3.
1.3 One-variable analysis: Goodness-of-fit and expected frequencies
Chi-square testing begins with analyzing a single variable divided into categories, often relating observed counts to counts expected under the null hypothesis (H0). This is known as a goodness-of-fit test.
The core of the test relies on comparing observed frequencies (O), which are the actual counts from the study, against expected frequencies (E), which are the counts predicted if the null hypothesis is true.
Defining Expected Frequencies
The null hypothesis in chi-square analysis posits that the population distribution matches the pattern of proportions defined by the expected frequencies. For a simple one-row analysis, if there are k categories and the total number of cases is N, the expected frequency in each cell, assuming randomness or no effect (H0 true), is calculated by dividing the total sample size by the number of categories: E=kN For the case where women either 'lost' or 'gained' up to 1 inch from their hips after using a product (two categories, k=2), with N=550 total respondents, the expected frequencies under H0 are 550/2=275 for both 'loss' and 'gain'.
Example: In the Dior gel study, the observed frequencies for hip measurement changes were 286 (Loss) and 264 (Gain). The expected frequencies, assuming the null hypothesis (random selection between the two options), were 275 for both categories 6.

Calculating the Chi-Square Statistic
The chi-square statistic quantifies the discrepancy between observed and expected frequencies. It increases as the observed cell values move further away from those expected under H0. The formula for the chi-square statistic is: χ2=∑E(O−E)2 The calculation involves calculating the term E(O−E)2 for every cell and then summing these results.
The data from the hip measurement example yields the following calculation:

For the hip data, the resulting χ2 value is 0.88.
Degrees of Freedom and Significance Testing
To determine significance, the calculated χ2 value must be compared against a critical value, which depends on the degrees of freedom (df). For a one-row analysis with k cells, the degrees of freedom are: df=k−1 In the hip example, k=2, so df=2−1=1.
If the calculated χ2 value is less than the critical value required for a specified alpha level (e.g., χcritical2≤3.84 for p≤.05 with df=1 in a two-tailed test), the difference is not statistically significant. Therefore, the conclusion for the hip data is that the gel did not result in a significantly different proportion of women reporting loss versus gain 7.
Example: When performing the same calculation for the thigh data (Observed: 308 Loss, 242 Gain; Expected: 275 each), the resulting χ2 value is 7.92. Since 7.92 exceeds the critical value of 3.84, this result is significant, suggesting a possible effect from the gel on thigh measurements.
1.4 Limitations and Advanced Designs
A critical statistical debate surrounds the issue of low expected cell frequencies. Generally, no more than 20% of expected frequency cell counts should be less than 5. If low expected frequencies occur, having total sample sizes exceeding 20 can keep the risk of a Type I error acceptably low, especially if using p≤.01 1 4.
While the one-row analysis is simple, scientific testing often requires a control group for comparison, leading to more complex designs like the 2×2 chi-square analysis, which compares experimental groups against control groups. Furthermore, chi-square testing can be generalized to analyze r×c tables (tables with any number of rows and columns). Log-linear analysis builds upon these principles to investigate higher-order interactions in multi-way tables 2 8.
2. Two-way frequency tables and the 2 x 2 chi-square test of association
This topic covers the use of two-way frequency tables (cross-tabulations) to assess the association between two categorical variables, focusing specifically on the 2×2 chi-square test, interpretation of significance, and estimation of effect size using the phi coefficient.
Two-way frequency tables and categorical variables
Two-way frequency tables, or cross-tabs, display the observed frequencies for two categorical variables simultaneously. This structure allows researchers to examine potential relationships between them, such as whether using a gel is associated with changes in body measurements or whether personality type (introvert/extrovert) is associated with comfort levels in a specific setting. Both variables must be measured at a categorical level, meaning they have distinct, qualitative levels rather than being measured on a continuous scale.
In these tables, the totals for each row and column, along with the overall total, are known as marginals.
Example: A comparison of gel use versus a control group regarding thigh measurements shows a 2×2 table setup:
In contrast, a table involving more than two categories for either variable (e.g., three litter conditions versus two outcomes) is referred to as an R×C design (e.g., 3×2).
Example: Researchers tested if the amount of existing litter influenced participants' tendency to drop leaflets:
The 2×2 Chi-square test of association
The 2×2 chi-square (χ2) test is used to determine if there is a statistically significant association between the two categorical variables in the simplest cross-tabulation design 9.
The null hypothesis (H0) for this test posits that there is absolutely no association between the two variables in the population; that is, the distribution of one variable within the categories of the other is proportional to the overall marginal distributions.
Calculating Expected Frequencies (E)
Expected frequencies represent the cell counts that would be anticipated if the null hypothesis were true. They are calculated using the row marginals (R), column marginals (C), and the grand total (T) ] 11: E=TRC
For a 2×2 table where marginals are simple, if 50% of participants overall gained weight, we would expect 50% of the gel users and 50% of the control group to fall into the 'gained' category, assuming no effect of the gel 10.
Example: For the introverts/extroverts and comfort level data, where both rows and columns total 50, the expected frequency in every cell is 50×50/100=25.
Chi-square Calculation
The chi-square test statistic measures the discrepancy between the observed frequencies (O) and the expected frequencies (E): χ2=∑E(O−E)2 This calculation is performed across all cells in the table 12.
For a 2×2 table, an alternative, direct formula using the observed cell totals (a,b,c,d) and the total sample size (N) exists, which bypasses the initial calculation of expected frequencies: χ2=(a+b)(c+d)(a+c)(b+d)N(ad−bc)2 Here, N=(a+b+c+d).
Degrees of Freedom (df) and Significance
The degrees of freedom for a contingency table are calculated as: df=(R−1)(C−1) For a 2×2 table, R=2 and C=2, resulting in df=(2−1)(2−1)=1. df represents the number of cell values that must be known (along with the marginals) to determine all other cell values.
To determine significance, the calculated χ2 value is compared against a critical value corresponding to the chosen alpha level (typically p≤0.05) and the calculated df. If χcalculated2≥χcritical2, the null hypothesis is rejected, indicating a significant association.
Effect Size Estimation
When a significant result is found, it is crucial to estimate the effect size to gauge the magnitude of the association found, regardless of sample size. For 2×2 tables, the phi coefficient (ϕ) is used, which is a specific case of Cramer's ϕ (or Cramer's V) 13.
Cramer's ϕ is defined generally as: ϕ=N⋅dfsmallerχ2 where dfsmaller is the smaller value between (rows - 1) or (columns - 1).
Since for a 2×2 table dfsmaller=1, the formula simplifies to the phi coefficient: ϕ=Nχ2
Cohen provided conventions for interpreting Cramer's ϕ based on dfsmaller.
Tip: Remember that interpretation thresholds for small, medium, and large effects change depending on the degrees of freedom available in the table structure.
When reporting the results, include χ2, degrees of freedom, sample size (N), p-value, and the effect size (ϕ or Cramer's ϕ) 14.
Extension: R×C Designs and Goodness of Fit
The chi-square test extends beyond 2×2 tables to R×C designs (e.g., 3×2 or 3×3), where one or both variables have more than two categories. The expected frequency formula E=RC/T still applies, and df is calculated generally as (R−1)(C−1) 15.
Goodness of Fit Test
The χ2 test can also be applied to a single variable with multiple categories to test if the observed frequency distribution significantly differs from a theoretical pattern; this is known as the goodness of fit test.
The null hypothesis here is that the data align with the theoretical distribution (e.g., equal preference across all categories). The degrees of freedom for a one-row test are df=(number of cells)−1 16.
For a goodness of fit test, the effect size (w) uses a slightly different calculation involving N: w=Nχ2 Cohen's conventions for w suggest 0.1 to 0.3 is small, 0.3 to 0.5 is moderate, and over 0.5 is large.
Example: In a study of accountancy students choosing an alternative subject, the goodness of fit test evaluates if the observed choices significantly depart from a scenario where all five subjects are equally preferred (E=123/5=24.6 for each cell) 17.
3. Limitations, power, and SPSS procedures for chi-square
This section covers the key restrictions on the application of chi-square tests, methods for estimating statistical power, the necessary SPSS steps for performing chi-square analyses, and an introduction to Log-Linear Analysis (LLA) for multi-way contingency tables.
3.1 Conducting chi-square tests in SPSS using weighted cases
When dealing with frequency data collected across two categorical variables (an r×c table), raw data entry for every participant can be cumbersome. SPSS allows for a shortcut using weighting cases by entering the cell totals into a separate 'count' variable.
For the litter-dropping example, variables must be defined: 'pieces' (nominal, coded 1, 2, 3 for low, medium, high) and 'drop' (nominal, coded 1 for dropped, 2 for no-drop). A measured variable named 'count' holds the observed frequencies for each cell combination 18.
The SPSS procedure for case weighting is:
- Define variables and enter the data (as seen in the top half of Figure 18.1).
- Navigate to
Data/Weight Cases/. - Select the radio button
Weight Cases Byand enter the 'count' variable into the right-hand box. - Click OK.

To conduct the Pearson Chi-Square test after weighting:
- Go to
Analyze/Descriptives/Crosstabs. - Place the row variable (e.g., 'drop') in the Row(s) box and the column variable (e.g., 'pieces') in the Column(s) box.
- Click the Statistics button and check Chi-square. For effect size, check Phi and Cramer's V.
- Click Cells and check Expected under Counts to obtain expected cell frequencies.
- Click OK.
The output will include a confirmation of the total cases (e.g., N=358 for the Cialdini study) and the cross-tabulation table, including the expected frequencies. The key result is the Pearson Chi-Square value, its degrees of freedom (df), and the asymptotic significance (p-value).
Tip: The non-parametric test menu in SPSS (
Non-parametric Tests/Legacy Dialogs/Chi-Square) performs a different procedure (Goodness-of-Fit test for a single variable) and should not be used for contingency tables; use Crosstabs instead.
The Goodness-of-Fit test for a single-variable, multi-category comparison (like Table 18.11) requires defining the categories (e.g., 'courses' as nominal) and weighting cases by their frequency count using the same Data/Weight Cases procedure, followed by running the test via Analyze/Non-parametric test/One Sample 20.
3.2 Limitations of the chi-square test
The utility of the chi-square test is subject to several critical assumptions and limitations regarding the nature of the data in the cells:
- Unique Cell Membership: Each observation (person or case) must belong to only one cell in the contingency table. If a participant fits into multiple categories (e.g., participating in both Football and Cricket in the example scenario), the independence assumption is violated, invalidating the results.
- Frequency Data Only: Cell contents must strictly represent frequency counts (the number of instances observed). Chi-square tests cannot be calculated using non-frequency data such as means, proportions, ratios, or percentages.
- Low Expected Frequencies: The presence of low expected frequencies (E) causes problems with the accuracy of the Pearson chi-square approximation.
- Cochran's Rule (Traditional): No more than 20% of the expected frequency cells should fall below 5. This rules out any 2×2 calculation where a single expected cell count is below 5 21.
- Alternative Views: Some argue this rule is too conservative, increasing Type II errors. For 2×2 tests, Camilli and Hopkins argued they are safe even if one or two expected frequencies are as low as 1 or 2, provided the total sample size (N) is greater than 20.
- When low frequencies are unavoidable, Fisher's exact test is preferred, as it calculates probability directly from observed frequencies. SPSS often provides this result alongside the Pearson statistic.
Example: If a 2×2 table yields an expected frequency of 4 in all cells (such as in Table 18.13 where N=16), the Pearson p=.046 suggests significance, but Fisher's test (p=.066) suggests otherwise, highlighting the concern with small expected counts 22.
To mitigate the low expected frequency issue:
- Design the study to avoid low samples in specific categories (e.g., be cautious with hard-to-find groups like left-handers or specific disorder groups).
- Maintain a sufficiently large overall sample size; N>20 helps for 2×2 tables, but larger is better.
- If significance is achieved at p≤.01 instead of p≤.05, the rejection of the null hypothesis is considered more secure.
Finally, for chi-square tests on two-way tables, the two-tailed value must always be used, regardless of whether the hypothesis is directional. The one-tailed exception only applies to the simple one-variable, two-category goodness-of-fit test.
3.3 Estimating power for chi-square analysis
Statistical power in chi-square analysis can be estimated by consulting specialized tables (like Table 18.14) using three inputs: the effect size (Small, Medium, Large), the total degrees of freedom (df), and the total sample size (N).
For example, the Cialdini et al. study had an effect size near Medium, df=2, and N=358. Using N=200 in the table provided, the estimated power was found to be .99 This indicates a very high probability of detecting the effect if it truly exists. Interpolation between table values is possible if N falls between listed totals 23 24.
3.4 Introduction to Log-Linear Analysis (LLA)
When working with frequency data involving three or more categorical variables (multi-way tables), standard two-way chi-square analysis is inadequate. Log-Linear Analysis (LLA) is employed to examine significance across levels of two or more independent variables simultaneously, allowing the investigation of complex interactions. LLA requires nominal/categorical data and assumes independent samples where each case falls into only one cell 27 28.
LLA seeks to explain the total variation among the frequency cells away from what would be expected based on the margin totals (row and column totals) 29.
Log-Linear Models and Structure
LLA uses models to explain cell variation. In a simple two-way analysis (Age vs. Smoking, Table 18.16), the null hypothesis model assumes expected frequencies (Eij) are proportional to row and column totals: Eij=cSiAj where c is a constant, Si is the row adjustment (smoking), and Aj is the column adjustment (age) 31.
The term 'log-linear' arises because, for higher-order tables, statisticians use the natural logarithm (ln) to convert multiplication into addition, making the equation linear: lnE=lnc+lnSi+lnAj Using the common LLA symbolism (λ for the log of the geometric means): lnE=λ+λS+λA This form is preferred mathematically 32.
The Saturated Model and Backward Hierarchical Elimination
LLA analysis proceeds by fitting a series of models, starting with the most complex:
-
Saturated Model: This model includes all main effects and all possible interactions, perfectly accounting for all observed cell variation. When the saturated model is used, the resulting chi-square statistic is zero (χ2=0), meaning the expected frequencies equal the observed frequencies (Eij=Oij). For a three-way table (e.g., Car Age × Gender × Stopping), the saturated model equation in log form would include the three main effects and all three possible two-way interactions plus the three-way interaction: lnE=λ+λC+λG+λS+λCG+λCS+λGS+λCGS (Using C for car age, G for gender, S for stopping).
-
Backward Hierarchical Log-Linear Analysis: The analysis technique involves sequentially removing terms from the saturated model, starting with the highest-order interaction (e.g., the three-way interaction in a three-way table).
-
Chi-Square Change: When a term is removed, LLA calculates a Likelihood Ratio Chi-Square (LRχ2) and the Chi-Square Change between the model with the term and the model without it. If this change is statistically significant, the removed term is deemed important and must be retained in the final model.
The process stops when removing the next term results in a non-significant χ2 change. The resulting model is the most parsimonious explanation for the observed cell variations. For instance, if the interaction term (λSA) is significant when removed from the saturated model, it implies the interaction is necessary, and the analysis stops there, retaining the interaction and all lower-order effects.
Key Terms in LLA:
- Saturated model: Explains all cell variation (χ2=0).
- Backward hierarchical log-linear analysis: Removing higher-order interactions systematically from the saturated model 33.
- Likelihood ratio chi-square (LRχ2): The preferred statistic for pitting one LLA model against another.
If no interactions are significant, the best model might only contain the main effects, as shown in Table 18.17, where the final equation is lnE=λ+λS+λA 34.





This section details the constraints on using chi-square tests, introduces the concept of power, provides detailed SPSS instructions for standard chi-square and the more advanced log-linear analysis (LLA) for multi-way contingency tables, and defines key related terminology.
Limitations of Chi-Square Tests
The chi-square test has strict requirements regarding the type and structure of data used for analysis. Violating these rules can render the resulting statistics invalid.
Key limitations include:
- Frequency Data Only: Chi-square tests can only be applied to frequency data (counts) within the cells of a cross-tabulation table. Ratios or percentages cannot be used directly in the calculation.
- Mutually Exclusive Observations: Each participant or observation must belong to one and only one cell in the contingency table. If an observation can occupy multiple cells (e.g., choosing multiple options in a survey), chi-square is inappropriate for that data design.
Tip: Before collecting data, ensure the study design permits a chi-square analysis as intended, as this is critical for appropriate later analysis. Always remember to weight cases appropriately in SPSS for analyses involving frequency weighting.
Understanding Expected Frequencies and Power
A crucial aspect of interpreting chi-square results involves understanding what the calculated "expected frequencies" represent, particularly in relation to the null hypothesis.
Expected frequencies (E) are not the researcher's hypothesis; rather, they represent the frequencies that should occur if the null hypothesis of no association between the variables is perfectly true. These values are mathematically determined based solely on the size of the marginal totals (the row and column totals) in the cross-tabs table.
While the provided text mentions the need to consider power, it focuses more heavily on interpreting interaction effects in LLA. In LLA, the focus is often on testing whether removing higher-order interaction terms (like the three-way interaction) causes a significant change in the Likelihood Ratio chi-square (χ2) statistic.
SPSS Procedures for Log-Linear Analysis (LLA)
Log-linear analysis (LLA) is introduced as the appropriate method for examining three-way or higher-order frequency tables, overcoming the limitations of repeatedly conducting two-way chi-square analyses. LLA examines the interactions between all categorical variables simultaneously using a proposed log-linear model.
Data Entry and Setup for LLA in SPSS
To conduct a three-way LLA in SPSS, data must be weighted as if they were in a cross-tabs format:
- Navigate to Analyze/Log-linear/Model Selection.
- Move the three categorical variables (e.g.,
carage,gender,stopped) into the Factors box. - For each factor, select Define Range and specify the minimum and maximum codes (e.g., 1 and 2) for that variable.
- It is advised to leave default settings for Model and Options initially, although unchecking 'Frequencies' and 'Residuals' in Options can reduce output clutter if using the saturated model 36.
- Click OK to run the analysis.
The input data structure involves a count representing the frequency for each unique combination of factors, as illustrated for the driving data:

Interpreting LLA Output: Saturated Model and Interactions
The analysis begins by testing the saturated model, which includes all possible effects and interactions. For a three-way table (C, G, S), the saturated model equation for expected frequencies (InE) includes main effects, two-way interactions, and the three-way interaction: InE=λ+λC+λG+λS+λCG+λCS+λGS+λCGS (Note: The text uses an alternative notation based on effects, which implies testing removal of terms from the full structure ) 35.
The SPSS output provides two key tables for determining which terms to retain:
- K-Way and Higher-Order Effects Table: This initially confirms the significance of the highest order interaction (e.g., the three-way interaction, K=3). If this effect is non-significant (e.g., p=.178 for the three-way interaction in the example), it suggests that the variation explained by this highest interaction is not statistically significant. The significance of lower-order combinations (e.g., K=2 for two-way effects and higher) is also assessed here 37.

- Step Summary Table (Backward Hierarchical Elimination): This table details the process of backward hierarchical elimination, where non-significant interaction terms are systematically removed starting from the highest order down to the one-way main effects.
- If removing a term does not result in a significant χ2 change (i.e., p>.050 for the change), that term is dropped from the model.
- If removing a term does cause a significant χ2 change, that term is retained in the final model. Main effects contributing to retained interactions are also kept.
In the provided example concerning driving behavior, the final significant model retained the two-way interactions: age of car $\times$ stopping and gender $\times$ stopping, but not the three-way interaction or the age of car $\times$ gender interaction 39.
Example Application of LLA
LLA is useful for testing complex theoretical hypotheses. For instance, one study examined if the relationship between graduation status and comfort level on a nudist beach differed based on extroversion/introversion.

In this case, the three-way interaction (extrovert/introvert $\times$ graduation status $\times$ comfort level) was found to be significant (LR χ2=4.63,p=.031). This significance indicated that the patterns of comfort levels across graduation status were different for introverts compared to extroverts, supporting the complex hypothesis that graduates might show less extreme divisions in comfort levels than non-graduates, primarily driven by graduate introverts 1.
Glossary of Key LLA Terms
The following terms are essential for understanding chi-square and LLA procedures:
- Saturated Model: A log-linear model that accounts for all variation in the multi-way frequency table, resulting in a chi-square value of zero, where expected frequencies equal observed frequencies.
- Likelihood Ratio Chi-Square (LR χ2): A specific type of chi-square statistic utilized in log-linear analysis.
- Backward Hierarchical Log-linear Analysis: The procedure of systematically removing interaction terms from the saturated model, moving downward toward one-way effects, based on the significance of the resultant χ2 change 38.
- Marginals: The row totals, column totals, and the grand total of frequencies within a cross-tabs table, used to calculate expected frequencies under the null hypothesis 40 42.
- Cramer's phi or V: A general statistic used to estimate the effect size following a chi-square analysis 41.
Common mistakes to avoid
- Review all topics thoroughly before exams
- Pay attention to formulas and key definitions
- Practice with examples provided in each section
- Don't memorize without understanding the underlying concepts
© 2026 Maeve. All rights reserved. This content is protected by copyright.



