deltamethod()
can run hypothesis tests on objects
produced by the comparisons()
,
marginaleffects()
, predictions()
, and
marginalmeans()
functions. This feature relies on
match.call()
, which means it may not always work when used
programmatically, inside functions and nested environments. It is
generally safer and more efficient to use the hypothesis
argument.plot_cme()
and plot_cco()
accept lists
with user-specified values for the regressors, and can display nice
labels for shortcut string-functions like “threenum” or “quartile”.posteriordraws
: new shape
argument to
return MCMC draws in various formats, including the new
rvar
structure from the posterior
package.transform_avg
function gets printed in
summary()
output.transform_post
and transform_avg
support
string shortcuts: “exp” and “ln”mlm
models from lm()
.
Thanks to Noah Greifer.Bug fixes:
hypothesis
argument with bayesian models and
tidy()
used to raise an error.comparisons()
output for brms
models.Breaking change:
interaction
argument is deprecated and replaced by
the cross
argument. This is to reduce ambiguity with
respect to the interaction
argument in
emmeans
, which does something completely different, akin to
the difference-in-differences illustrated in the Interactions
vignette.71 classes of models supported, including the new:
rms::ols
rms::lrm
rms::orm
New features:
plot_cme()
, plot_cap()
, and
plot_cco()
are now much more flexible in specifying the
comparisons to display. The condition
argument accepts
lists, functions, and shortcuts for common reference values, such as
“minmax”, “threenum”, etc.variables
argument of the comparisons()
function is more flexible:
variables
argument of the comparisons
function.variables
argument of the predictions()
function is more flexible:
brms
models
(see Bayesian analysis vignette)New vignettes:
Bug fixes and minor improvements:
conf_level
in
summary()
and tidy()
is now NULL
,
which inherits the conf_level
value in the original
comparisons
/marginaleffects
/predictions
calls.fixest::i()
are parsed properly as
categorical variablesbetareg
objects, inference can now be done on all
coefficients using deltamethod()
. previously only the
location coefficients were available.crch
package, a number of bugs have
been fixed; standard errors should now be correct for
deltamethod()
, marginaleffects()
, etc.tidy()
function for
glmmTMB
models without random effects, which caused all t
statistics to be identical.gamlss
. Thanks to Marcio
Augusto Diniz.marginalmeans()
accepts a wts
argument
with values: “equal”, “proportional”, “cells”.by
argument
marginalmeans
only accepts data frames.byfun
argument for the predictions()
function to aggregate using different functions.hypothesis
argument
wts
argument is respected in by
argument
and with *avg
shortcuts in the transform_pre
argument.tidy.predictions()
and
tidy.marginalmeans()
get a new transform_avg
argument.marginaleffects
. Thanks to @timpipeseek.Breaking changes:
by
is deprecated in summary()
and
tidy()
. Use the same by
argument in the main
functions instead: comparisons()
,
marginaleffects()
, predictions()
variables
argument of the predictions()
function. Use newdata="fivenum"
or “grid”, “mean”, or
“median” instead.Critical bug fix:
New supported packages and models:
survival::clogit
biglm
: The main quantities can be computed, but not the
delta method standard errors. See
https://github.com/vincentarelbundock/marginaleffects/issues/387New vignette:
New features:
slope
argument in marginaleffects()
: eyex, dyex, eydxdatagrid()
accepts functions:
datagrid(newdata = mtcars, hp = range, mpg = fivenum, wt = sd)
datagridcf()
function to create counterfactual
datasets. This is a shortcut to the datagrid()
function
with default to grid_type = "counterfactual"
by
arguments in predictions()
,
comparisons()
, marginaleffects()
newdata
shortcuts: “tukey”, “grid”transform_pre
in
comparisons()
marginalmeans()
now back transforms confidence
intervals when possible.vcov
argument string shortcuts are now
case-insensitivecomparisons()
for binary
predictors is now a difference between 1 and 0, rather than +1 relative
to baseline.New supported packages and models:
tidymodels
objects of class tidy_model
are
supported if the fit engine is supported by
marginaleffects
.New function:
deltamethod()
: Hypothesis tests on functions of
parametersplot_cco()
: Plot conditional contrastsNew arguments:
hypothesis
for hypothesis tests and custom
contraststransform_post
in predictions()
wts
argument in predictions()
only affects
average predictions in tidy()
or
summary()
.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.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 predictionsgam
models with matrix columns.eps
in marginaleffects()
is now “adaptive”
by default: it equals 0.0001 multiplied the range of the predictor
variablecomparisons()
now supports “log of marginal odds ratio”
in the transform_pre
argument. Thanks to Noah Greifer.transform_pre
shortcuts: dydx, expdydxtidy.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()
.variables
argument of the
comparisons()
function accepts a named list to specify
variable-specific contrast types.vcov
argument. This
requires version 0.17.1 of the insight
package.
sandwich
package shortcuts: vcov = "HC3"
,
"HC2"
, "NeweyWest"
, and more.vcov = "satterthwaite"
or
"kenward-roger"
vcov = ~cluster_variable
marginalmeans()
allows interactionsbrms
models using
type = "average"
. See vignette on the
marginaleffects
website.eps
argument for step size of numerical derivativemarginaleffects
and comparisons
now report
confidence intervals by default.data.table
package yields
substantial performance improvements.New pages on the marginaleffects
website:
https://vincentarelbundock.github.io/marginaleffects/
Argument name changes (backward compatibility is preserved:
conf.level
-> conf_level
datagrid()
:
FUN.factor
-> FUN_factor
(same for
related arguments)grid.type
-> grid_type
New supported packages and models:
stats::loess
sampleSelection::selection
sampleSelection::heckit
Misc:
mgcv::bam
models allow exclude
argument.include_smooth
argument.New function:
comparisons()
computes contrastsMisc:
predictions()
and plot_cap()
include
confidence intervals for linear modelsggplot2::theme_set()
callNew supported models:
mclogit::mclogit
robust::lmRob
robustlmm::rlmer
fixest
confidence intervals in
predictions
Misc:
modelbased::visualisation_matrix
in
newdata
without having to specify x
explicitly.tidy.predictions()
and
summary.predictions()
methods.Support for new models and packages:
brglm2::bracl
mclogit::mblogit
scam::scam
lmerTest::lmer
Misc:
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)))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:
brms::brm
rstanarm::stanglm
brglm2::brmultinom
MASS::glmmPQL
aod::betabin
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
.brms
lme4
data.table
package is installed,
marginaleffects
will automatically use it to speed things
up.marginaleffects
output.type
argument.emmeans
Breaking change:
data
argument becomes newdata
in all
functions.New supported packages and models:
lme4:glmer.nb
mgcv::gam
ordinal::clm
mgcv
marginalmeans
:
variables_grid
argumentpredictions
:
mgcv
plot_cap
type
argumentMisc:
First release. Bravo!
Thanks to Marco Avina Mendoza, Resul Umit, and all those who offered comments and suggestions.