New supported packages and models:

New vignette:

  • Frequently Asked Questions

New supported packages and models:

  • tidymodels objects of class tidy_model are supported if the fit engine is supported by marginaleffects.

New function:

New arguments:

New or improved vignettes:

Deprecated or renamed arguments:

  • contrast_factor and contrast_numeric arguments are deprecated in comparisons(). Use a named list in the variables argument instead. Backward compatibility is maintained.
  • The transform_post argument in tidy() and summary() is renamed to transform_avg to disambiguate against the argument of the same name in comparisons(). Backward compatibility is preserved.

Misc:

  • tidy.predictions() computes standard errors using the delta method for average predictions
  • Support gam models with matrix columns.
  • eps in marginaleffects() is now “adaptive” by default: it equals 0.0001 multiplied the range of the predictor variable
  • comparisons() now supports “log of marginal odds ratio” in the transform_pre argument. Thanks to Noah Greifer.
  • New transform_pre shortcuts: dydx, expdydx
  • tidy.predictions() computes standard errors and confidence intervals for linear models or GLM on the link scale.

Breaking changes:

  • type no longer accepts a character vector. Must be a single string.
  • conf.int argument deprecated. Use vcov = FALSE instead.

New supported packages and models:

  • mlogit
  • mhurdle
  • tobit1
  • glmmTMB

New features:

  • interaction argument in comparisons() to compute interactions between contrasts (cross-contrasts).
  • by argument in tidy() and summary() computes group-average marginal effects and comparisons.
  • transform_pre argument can define custom contrasts between adjusted predictions (e.g., log adjusted risk ratios). Available in comparisons().
  • transform_post argument allows back transformation before returning the final results. Available in comparisons(), marginalmeans(), summary(), tidy().
  • The variables argument of the comparisons() function accepts a named list to specify variable-specific contrast types.
  • Robust standard errors with the vcov argument. This requires version 0.17.1 of the insight package.
    • sandwich package shortcuts: vcov = "HC3", "HC2", "NeweyWest", and more.
    • Mixed effects models: vcov = "satterthwaite" or "kenward-roger"
    • One-sided formula to clusters: vcov = ~cluster_variable
    • Variance-covariance matrix
    • Function which returns a named squared matrix
  • marginalmeans() allows interactions
  • Bayesian Model Averaging for brms models using type = "average". See vignette on the marginaleffects website.
  • eps argument for step size of numerical derivative
  • marginaleffects and comparisons now report confidence intervals by default.
  • New dependency on the data.table package yields substantial performance improvements.
  • More informative error messages and warnings
  • Bug fixes and performance improvements

New pages on the marginaleffects website: https://vincentarelbundock.github.io/marginaleffects/

  • Alternative software packages
  • Robust standard errors (and more)
  • Performance tips
  • Tables and plots
  • Multinomial Logit and Discrete Choice Models
  • Generalized Additive Models
  • Mixed effects models (Bayesian and Frequentist)
  • Transformations and Custom Contrasts: Adjusted Risk Ratio Example

Argument name changes (backward compatibility is preserved:

  • Everywhere:
    • conf.level -> conf_level
  • datagrid():
    • FUN.factor -> FUN_factor (same for related arguments)
    • grid.type -> grid_type

New supported packages and models:

Misc:

  • mgcv::bam models allow exclude argument.
  • Gam models allow include_smooth argument.
  • New tests
  • Bug fixes

New function:

Misc:

  • Speed optimizations
  • predictions() and plot_cap() include confidence intervals for linear models
  • More robust handling of in-formula functions: factor(), strata(), mo()
  • Do not overwrite user’s ggplot2::theme_set() call
  • Bug fixes

New supported models:

Misc:

Support for new models and packages:

Misc:

  • Drop numDeriv dependency, but make it available via a global option: options(“marginaleffects_numDeriv” = list(method = “Richardson”, method.args = list(eps = 1e-5, d = 0.0001)))
  • Bugfixes
  • Documentation improvements
  • CRAN tests

documentation bugfix

Breaking changes:

  • predictions returns predictions for every observation in the original dataset instead of newdata=datagrid().
  • marginalmeans objects have new column names, as do the corresponding tidy and summary outputs.

New supported packages and models:

Misc:

  • datagrid function supersedes typical and counterfactual with the grid.type argument. The typical and counterfactual functions will remain available and exported, but their use is not encouraged.
  • posteriordraws function can be applied to a predictions or a marginaleffects object to extract draws from the posterior distribution.
  • marginalmeans standard errors are now computed using the delta method.
  • predictions standard errors are now computed using the delta method when they are not available from insight::get_predicted.
  • New vignette on Bayesian models with brms
  • New vignette on Mixed effects models with lme4
  • If the data.table package is installed, marginaleffects will automatically use it to speed things up.
  • Contrast definition reported in a separate column of marginaleffects output.
  • Safer handling of the type argument.
  • Comprehensive list of supported and tests models on the website.
  • Many bug fixes
  • Many new tests, including several against emmeans

Breaking change:

  • data argument becomes newdata in all functions.

New supported packages and models:

marginalmeans:

  • New variables_grid argument

predictions:

  • Support mgcv

plot_cap

  • New type argument

Misc:

  • New validity checks and tests

First release. Bravo!

Thanks to Marco Avina Mendoza, Resul Umit, and all those who offered comments and suggestions.