Skip to main content

No project description provided

Project description

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, such as predictions, contrasts, risk differences, ratios, odds, lift, slopes, and so on.

Unfortunately, computing these quantities—along with associated standard errors—can be a tedious and error-prone task. This problem is compounded by the fact that modeling packages in R and Python produce objects with varied structures, which hold different information. This means that end-users often have to write customized code to interpret the estimates obtained by fitting Linear, GLM, GAM, Bayesian, Mixed Effects, and other model types. This can lead to wasted effort, confusion, and mistakes, and it can hinder the implementation of best practices.

Free Book

This free online book introduces a conceptual framework to clearly define statistical quantities of interest, and shows how to estimate those quantities using the marginaleffects package for R and Python. The techniques introduced herein can enhance the interpretability of over 100 classes of statistical and machine learning models, including linear, GLM, GAM, mixed-effects, bayesian, categorical outcomes, XGBoost, and more. With a single unified interface, users can compute and plot many estimands, including:

  • Predictions (aka fitted values or adjusted predictions)
  • Comparisons such as contrasts, risk differences, risk ratios, odds, etc.
  • Slopes (aka marginal effects or partial derivatives)
  • Marginal means
  • Linear and non-linear hypothesis tests
  • Equivalence tests
  • Uncertainty estimates using the delta method, bootstrapping, simulation, or conformal inference.
  • Much more!

The Marginal Effects Zoo book includes over 30 chapters of tutorials, case studies, and technical notes. It covers a wide range of topics, including how the marginaleffects package can facilitate the analysis of:

  • Experiments
  • Observational data
  • Causal inference with G-Computation
  • Machine learning models
  • Bayesian modeling
  • Multilevel regression with post-stratification (MRP)
  • Missing data
  • Matching
  • Inverse probability weighting
  • Conformal prediction

Get started by clicking here!

Free Software

The marginaleffects package for R and Python offers a single point of entry to easily interpret the results of over 100 classes of models, using a simple and consistent user interface. Its benefits include:

  • Powerful: It can compute and plot predictions; comparisons (contrasts, risk ratios, etc.); slopes; and conduct hypothesis and equivalence tests for over 100 different classes of models in R.
  • Simple: All functions share a simple and unified interface.
  • Documented: Each function is thoroughly documented with abundant examples. The Marginal Effects Zoo website includes 20,000+ words of vignettes and case studies.
  • Efficient: Some operations can be up to 1000 times faster and use 30 times less memory than with the margins package.
  • Valid: When possible, numerical results are checked against alternative software like Stata or other R packages.
  • Thin: The R package requires relatively few dependencies.
  • Standards-compliant: marginaleffects follows “tidy” principles and returns simple data frames that work with all standard R functions. The outputs are easy to program with and feed to other packages like ggplot2 or modelsummary.
  • Extensible: Adding support for new models is very easy, often requiring less than 10 lines of new code. Please submit feature requests on Github.
  • Active development: Bugs are fixed promptly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marginaleffects-0.0.12.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

marginaleffects-0.0.12-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file marginaleffects-0.0.12.tar.gz.

File metadata

  • Download URL: marginaleffects-0.0.12.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-31-generic

File hashes

Hashes for marginaleffects-0.0.12.tar.gz
Algorithm Hash digest
SHA256 eb8456a1d2833524b5aa4482f67c114a2243f185b3577f10cb0c49d1bb0e3816
MD5 8555bdd51a6f707bf5d7f97c0c12c154
BLAKE2b-256 6c2b3c7a5015f657c54584a3af8f8940328014445b8cc3f6ca9e691edb54cc35

See more details on using hashes here.

File details

Details for the file marginaleffects-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: marginaleffects-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 51.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-31-generic

File hashes

Hashes for marginaleffects-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 7d8bc8f935d8b7145f3ccb7c8cefc97396ca257c38fc1c380d6d5a8ce75e2d46
MD5 febe03107a124ee29602161ff377cad0
BLAKE2b-256 189384d40bdbc43a469afd92c6ca526a849bf5316a2682951f53ea359d2cbd62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page