How to Interpret Statistical Models Using {marginaleffects} in R and Python

Raw model results?
Stop! Hard to understand! Use
{marginaleffects}.
regression
marginal effect
slope
prediction

Vincent Arel-Bundock, Noah Greifer, and Andrew Heiss, “How to Interpret Statistical Models Using {marginaleffects} in R and Python,” Journal of Statistical Software forthcoming (2024), doi: 10.18637/jss.v111.i09

Authors
Affiliations

Université de Montréal

Institute for Quantitative Social Science, Harvard University

Andrew Young School of Policy Studies, Georgia State University

Published

October 2024

Doi

Abstract

The parameters of a statistical model can sometimes be difficult to interpret substantively, especially when that model includes non-linear components, interactions, or transformations. Analysts who fit such complex models often seek to transform raw parameter estimates into quantities that are easier for domain experts and stakeholders to understand. This article presents a simple conceptual framework to describe a vast array of such quantities of interest, which are reported under imprecise and inconsistent terminology across disciplines: predictions, marginal predictions, marginal means, marginal effects, conditional effects, slopes, contrasts, risk ratios, etc. We introduce {marginaleffects}, a package for R and Python which offers a simple and powerful interface to compute all of those quantities, and to conduct (non-)linear hypothesis and equivalence tests on them. {marginaleffects} is lightweight; extensible; it works well in combination with other R and Python packages; and it supports over 100 classes of models, including Linear, Generalized Linear, Generalized Additive, Mixed Effects, Bayesian, and several machine learning models.

Important figures

Figure 2: Predicted probability of impartiality by levels of equality and democracy

Figure 4: Tangents to the prediction function at 25 and 50

Citation

 Add to Zotero

@article{Arel-BundockGreiferHeiss:2024,
    title = {How to Interpret Statistical Models Using {marginaleffects} in {R} and {Python}},
    author = {Vincent Arel-Bundock and Noah Greifer and Andrew Heiss},
    doi = {10.18637/jss.v111.i09},
    journal = {Journal of Statistical Software},
    year = {2024},
    volume = {111},
    number = {9},
    pages = {1–32}}