mecompare
Marginal effects and cross-model comparisons of effects in Stata
mecompare calculates marginal effects and compares them across models. It implements the framework of Mize, Doan, and Long (2019): the models are combined with suest2, so tests of cross-model differences account for the covariances of the effects across models.
Some examples of the cross-model comparisons mecompare can be used for are effects across nested models (e.g., mediation and confounding), across alternative predictors, across different outcomes, across different model types (e.g., ordinal versus nominal), and across models fit to separate groups or samples.
mecompare also calculates marginal effects within a single model and automates comparisons among them. Some examples are comparing effect sizes across predictors, tests of interaction (second differences), and the summary measures of Mize and Han (2025): the ME inequality of a nominal predictor and the Total ME across the categories of a multi-category outcome. It also calculates generalized marginal effects, in which other variables, e.g. mediators, change along with the focal variable.
More generally, mecompare can be used for most any test of marginal effects within or across models. Custom tests – any contrast, ratio, or joint test of the marginal effects – can be done with metest.
Installation
net install mecompare, from("https://tdmize.github.io/data") replacemecompare requires Stata 16 or later and suest2, which installs the same way (net install suest2, from("https://tdmize.github.io/data") replace). metest is installed with mecompare.
Where to start
- Getting started walks through one comparison and explains the table.
- Options goes through every option with an example of each and lists the supported models; Plotting and tabulating results covers
store()withcoefplotandesttab. - The Examples in the sidebar reproduce the examples of Mize, Doan, and Long (2019), Mize and Han (2025), and Mize and Han (forthcoming). Others use multilevel and panel models, including within-person effects. The Interactions pages reproduce the examples of Mize (2019) on nonlinear interaction effects.
- Examples from the help file runs the help file’s examples, and the help file is on the site.
Citation
mecompare implements the methods proposed by Mize, Doan, and Long (2019). If you use mecompare, please cite:
Mize, Trenton D., Long Doan, and J. Scott Long. 2019. “A General Framework for Comparing Predictions and Marginal Effects Across Models.” Sociological Methodology 49(1): 152–189. https://doi.org/10.1177/0081175019852763