Learn R Programming

⚠️There's a newer version (0.32.0) 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://vincentarelbundock.github.io/marginaleffects

Copy Link

Version

Install

install.packages('marginaleffects')

Monthly Downloads

60,808

Version

0.13.0

License

GPL (>= 3)

Maintainer

Vincent Arel-Bundock

Last Published

June 18th, 2023

Functions in marginaleffects (0.13.0)

get_model_matrix

Get a named model matrix
inferences

(EXPERIMENTAL) Bootstrap and Simulation-Based Inference
get_vcov

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

marginaleffects() is an alias to slopes()
get_predict

Get predicted values from a model object (internal function)
marginalmeans

marginal_means() is an alias to marginal_means()
hypotheses

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

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

Marginal Means
get_varcov_args

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

Extract Posterior Draws or Bootstrap Resamples from marginaleffects Objects
posteriordraws

posteriordraws() is an alias to posterior_draws()
predictions

Predictions
plot_comparisons

Plot Conditional or Marginal Comparisons
plot_predictions

Plot Conditional or Marginal Predictions
plot_slopes

Plot Conditional or Marginal Slopes
meffects

meffects() is an alias to slopes()
plot_cap

plot_predictions() is an alias to plot_predictions()
plot_cco

plot_comparisons() is an alias to plot_comparisons()
plot_cme

plot_slopes() is an alias to plot_slopes()
print.marginaleffects

Print marginaleffects objects
reexports

Objects exported from other packages
slopes

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

Internal function to set coefficients
sanitize_model_specific.glimML

Method to raise model-specific warnings and errors
expect_predictions

tinytest helper
expect_slopes

tinytest helper
get_averages

Average Estimates (aka "Margins")
comparisons

Comparisons Between Predictions Made With Different Regressor Values
complete_levels

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

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

tinytest helper
expect_margins

tinytest helper
datagrid

Data grids
deltamethod

deltamethod() is an alias to hypotheses()