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") replace

mecompare 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

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

Back to top