02 – Nonlinearities & Categorical Independent Variables
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.
2.0 Nonlinear effects
- In physics, a function is nonlinear if the outcome (y) is not simply the additive product of all of the causes (x’s)
- This can happen because effects of continuous IVs are not constant
- This can happen because some effects are contingent upon values of other IVs
- In applied statistics, we usually distinguish between those two sources:
- When effects of an IV are not constant we say the effect is nonlinear
- E.g., The prediction line is not perfectly straight
- When the effect of one IV is contingent on the effects of another IV, we say the effects are interactive (as opposed to additive)
- When effects of an IV are not constant we say the effect is nonlinear
- Note everything above is in terms of effects. Linear regression models can—and often do—produce nonlinear effects. They often produce interactive effects. They can even produce nonlinear interactive effects
- Linear regression coefficients are useful when the effects are linear and additive. But this is a very special case. When effects are nonlinear and/or interactive we need different methods of summarizing and interpreting effects
Contents
- 2.1 Interpretation with Marginal Effects
- 2.2 Marginal Effects with Nonlinearities
- 2.3 Linear Interaction Effects
- 2.4 Nonlinear Interaction Effects
- 2.5 Examining Distributions
- 2.6 Assessing and Modeling Complex Nonlinearities for Independent Variables
- 2.7 Categorical Independent Variables
- 2.8 Comparing Effects Across IVs
- 2.10 Conclusion
- Appendix 2A: Stata Code and Tips
- Appendix 2B: Logged DV Regression Models (includes 2.9)
- Appendix 2C: Splines