Learn R Programming

⚠️There's a newer version (0.25.1) of this package.Take me there.

The marginaleffects package for R

marginaleffects allows users to compute and plot predictions, slopes, marginal means, and comparisons (contrasts, risk ratios, odds, etc.) for over 80 classes of statistical models. It can conduct linear and non-linear hypothesis tests, or equivalence tests, and calculate uncertainty estimates using the delta method, bootstrapping, or simulation-based inference.

The marginaleffects book (website) includes a “Get started” page, and over 25 chapters full of tutorials, case studies, and technical notes.

https://marginaleffects.com

Copy Link

Version

Install

install.packages('marginaleffects')

Monthly Downloads

23,482

Version

0.15.0

License

GPL (>= 3)

Maintainer

Vincent Arel-Bundock

Last Published

September 11th, 2023

Functions in marginaleffects (0.15.0)

get_averages

Average Estimates (aka "Margins")
hypotheses

(Non-)Linear Tests for Null Hypotheses, Joint Hypotheses, Equivalence, Non Superiority, and Non Inferiority
get_vcov

Get a named variance-covariance matrix from a model object (internal function)
expect_margins

tinytest helper
expect_predictions

tinytest helper
expect_slopes

tinytest helper
expect_marginal_means

tinytest helper
slopes

Slopes (aka Partial derivatives, Marginal Effects, or Trends)
marginalmeans

marginal_means() is an alias to marginal_means()
posteriordraws

posteriordraws() is an alias to posterior_draws()
marginaleffects

marginaleffects() is an alias to slopes()
get_group_names

Get levels of the outcome variable in grouped or multivariate models
predictions

Predictions
set_coef

Internal function to set coefficients
sanitize_model_specific.glimML

Method to raise model-specific warnings and errors
plot_comparisons

Plot Conditional or Marginal Comparisons
plot_predictions

Plot Conditional or Marginal Predictions
get_model_matrix

Get a named model matrix
print.marginaleffects

Print marginaleffects objects
get_coef

Get a named vector of coefficients from a model object (internal function)
marginal_means

Marginal Means
inferences

(EXPERIMENTAL) Bootstrap, Conformal, and Simulation-Based Inference
plot_cap

plot_predictions() is an alias to plot_predictions()
comparisons

Comparisons Between Predictions Made With Different Regressor Values
plot_cco

plot_comparisons() is an alias to plot_comparisons()
plot_cme

plot_slopes() is an alias to plot_slopes()
complete_levels

Create a data.frame with all factor or character levels
meffects

meffects() is an alias to slopes()
reexports

Objects exported from other packages
datagrid

Data grids
plot_slopes

Plot Conditional or Marginal Slopes
posterior_draws

Extract Posterior Draws or Bootstrap Resamples from marginaleffects Objects
deltamethod

deltamethod() is an alias to hypotheses()
get_varcov_args

Take a summary() style vcov argument and convert it to insight::get_varcov()
get_predict

Get predicted values from a model object (internal function)