Curvilinear effects and mediation/attenuation
Example 6.1 of Mize, Doan, and Long (2019)
Marginal effects can summarize a curvilinear relationship in a single number, which makes it easy to test, e.g., whether a nonlinear effect is attenuated across models. Here, we compare the effect of income, entered with a squared term in a linear regression of depressive symptoms, across a model with and without job satisfaction as a proposed mediator.
use "https://tdmize.github.io/data/data/ah4_cme", clear(ah4_cme.dta | Add Health Wave 4 | 2018-07-10)
drop if missing(depsympB, income, inc10, age, woman, race, college, jobsat)(0 observations deleted)
.
quietly regress depsympB c.income##c.income c.age i.woman i.race, vce(robust)
estimates store basemod.
quietly regress depsympB c.income##c.income c.age i.woman i.race i.jobsat, vce(robust)
estimates store medmodThe marginal effect of a one-standard-deviation increase in income in each model, and the difference between them:
mecompare income, models(basemod medmod) amount(sd)Predicting: Linear prediction
Marginal effects and cross-model differences (N_basemod=4307) (N_medmod=4307)
| ME # Estimate Robust SE P>|z|
---------------------------------+---------------------------------------
income + SD (centered) |
basemod | 1 -0.982 0.098 0.000
medmod | 2 -0.797 0.096 0.000
Difference | 3 -0.184 0.027 0.000
The Difference row is the test of whether the income effect is attenuated after adding job satisfaction to the model. metest can be used to calculate the proportion of the effect that is mediated, with its standard error:
metest (1 - 2) / 1 | estimate se pvalue
---------------------------------+--------------------------------
income |
(basemod - medmod) / basemod | 0.188 0.030 0.000