Nested logit models and mediation/attenuation
Example 6.2 of Mize, Doan, and Long (2019)
One of the most common cross-model questions is whether an effect changes when controls are added, such as in tests of mediation/attenuation. Here the effect of a college degree on the probability of being very happy is compared across four nested logits: the bivariate model, then a full set of controls, then wages, then occupational prestige. Unlike logit coefficients, marginal effects – here, changes in the predicted probability – can be compared across models without the problem of rescaling.
use "https://tdmize.github.io/data/data/gss_cme", clear(gss_cme.dta | GSS 1972 - 2016 Weighted | 2018-07-10)
drop if year < 2000(38,116 observations deleted)
drop if employed != 1(9,556 observations deleted)
drop if missing(vhappy, college, wages, occprest, age, married, parent, woman, conserv, reltrad)(5,578 observations deleted)
.
quietly logit vhappy i.college, vce(robust)
estimates store m1.
quietly logit vhappy i.college i.married i.parent i.woman i.conserv ///
i.reltrad i.year c.age##c.age, vce(robust)
estimates store m2.
quietly logit vhappy i.college c.wages i.married i.parent i.woman i.conserv ///
i.reltrad i.year c.age##c.age, vce(robust)
estimates store m3.
quietly logit vhappy i.college c.wages c.occprest i.married i.parent i.woman ///
i.conserv i.reltrad i.year c.age##c.age, vce(robust)
estimates store m4mecompare college, models(m1 m2 m3 m4)Predicting: Pr(vhappy)
Marginal effects across models (N_m1=9216) (N_m2=9216) (N_m3=9216) (N_m4=9216)
| ME # Estimate Robust SE P>|z|
---------------------------------+---------------------------------------
college |
College Deg - No Col Deg |
m1 | 1 0.072 0.010 0.000
m2 | 2 0.060 0.011 0.000
m3 | 3 0.036 0.011 0.001
m4 | 4 0.019 0.012 0.103
Use metest to calculate the cross-model tests. Here, whether the effect diminishes in each subsequent model.
metest, clear
metest 1 - 2, add | estimate se pvalue
---------------------------------+--------------------------------
college |
m1 - m2 | 0.012 0.004 0.003
metest 2 - 3, add | estimate se pvalue
---------------------------------+--------------------------------
college |
m1 - m2 | 0.012 0.004 0.003
m2 - m3 | 0.024 0.004 0.000
metest 3 - 4, add | estimate se pvalue
---------------------------------+--------------------------------
college |
m1 - m2 | 0.012 0.004 0.003
m2 - m3 | 0.024 0.004 0.000
m3 - m4 | 0.017 0.004 0.000
With two models, the Difference row is printed directly:
mecompare college, models(m1 m2)Predicting: Pr(vhappy)
Marginal effects and cross-model differences (N_m1=9216) (N_m2=9216)
| ME # Estimate Robust SE P>|z|
---------------------------------+---------------------------------------
college |
College Deg - No Col Deg |
m1 | 1 0.072 0.010 0.000
m2 | 2 0.060 0.011 0.000
Difference | 3 0.012 0.004 0.003