07 – Moderation & Mediation
Categorical Data Analysis (Soc 681) · Purdue University · Fall 2026
The lecture notes for this section of the course, with the Stata and R code and output for every example. This site contains all the material and code for the course. If you prefer the slides in PDF format and/or the Stata replication do-file, these can be downloaded at: lecture slides · replication code.
7.0 Moderation & Mediation
“… there will be a time when we must choose between what is easy and what is right”
- The famous statistician Albus Dumbledore—presumably commenting on moderation and mediation in nonlinear models

Overview of topics
- Nonlinear interaction effects (AKA statistical moderation)
- Best practices for testing interaction effects using predicted probabilities and marginal effects
- Interaction effects can be classified based on the measurement level of the IVs involved in the interaction:
- Nominal X Continuous interactions
- Nominal X Nominal interactions
- Continuous X Continuous interactions
- Interaction effects can be classified based on the measurement level of the IVs involved in the interaction:
- Best practices for testing interaction effects using predicted probabilities and marginal effects
- Cross-model comparisons (e.g., mediation) and the problem of comparing effects across nonlinear models
- Identification issues of coefficients
- Model rescaling
- Solutions to the rescaling problem
- Comparisons of predicted probabilities and marginal effects
- Identification issues of coefficients
Contents
- 7.1 Interaction Effects (AKA Moderation)
- 7.2 Testing for Interaction: Second Differences
- 7.3 Nominal X Continuous Interactions
- 7.4 Nominal X Nominal Interactions
- 7.5 Continuous X Continuous Interactions
- Nonlinear Interaction Effects: Summary of Recommendations
- 7.6 Count, ordinal, and nominal models
- 7.7 Cross-Model Comparisons & Statistical Mediation
- 7.8 The Problem of Rescaling in Logit/Probit
- 7.9 A General Framework for Cross-Model Comparisons
- 7.10 Group Comparisons
- 7.11 Takeaway Points: Interactions and Cross-Model Comparisons
- Appendix A7: Stata Code and Tips