Marginaleffects

Latest version: v0.1.1

Safety actively analyzes 723217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 7

0.25.1

Bugs:

* `df` is now respected when using the `multcomp` argument. Thanks to TonyRoberson for report 1414 and to ngreifer for the solution.
* Error when `hypotheses()` has both a number in `hypothesis` and a value in `multcomp`. Thanks to J. Rohrer for Issue 1381.
* Informative error: conformal inference is not supported for `tidymodels`
* `type` is respected for models of class `betareg`. Thanks to strengejacke for reporting issue 1391.
* `revreference` is available again in the `hypothesis` argument.
* `conformal_score="residual_sq"` incorrectly added the score to the prediction instead of absolute residual. Coverage was probably incorrect, with wider intervals than necessary. Issue 1407.
* `hypotheses()` supports multiple imputation objects from `mice`. Thanks to ASKurz for raising issue 1420.
* `tidymodels()` reshape bug.

Miscellaneous:

* Print order for equivalence test p values is changed.
* `collapse` is not necessary for hypothesis formulas. Thanks to ngreifer for Issue 1383.

0.25.0

Breaking changes in preparation for 1.0.0 release:

* The `hypothesis` argument no longer accepts strings like "reference" or "pairwise". Use the formula interface instead: `hypothesis= ~reference`
* The default `type` is now "survival" for models of class `coxph`, `flexsurvreg`, and `coxph_weightit`.
* `p_adjust` argument deprecated because of name-matching conflict with `p` argument in quantile regression and others. The recommended workflow is now to pass the object to the `hypotheses()` function and use its `multcomp` argument.
* Removed long deprecated functions from the code base. These functions were already raising errors: `marginaleffects`, `meffects`, `marginal_means`, `deltamethod`, `datagridcf`.
* `newdata="marginalmeans"` was changed to `newdata="balanced"` several releases ago, but backward compatibility was maintained. This shortcut is no longer available at all.

New:

* The `hypothesis` argument is more flexible. Thanks to mattansb for requests, testing, and documentation.
- `hypothesis = ratio ~ meandev | groupid`
- `hypothesis = ~ poly | groupid`
- `hypothesis = ~ helmert | groupid`
- `hypothesis = ~ trt_vs_ctrl | groupid`
- `hypothesis = ~ I(foo(x)) | groupid`
- `hypothesis = ~ I(\(x) c(a = x[1], b = mean(x[2:length(x))))`
* New function `get_dataset()` to download example data frames from the https://marginaleffects.com website. Thanks to bshor for the feature request.
* New `multcomp` argument for the `hypotheses()` function.
* `hypotheses()` inherits the `conf_level` from `marginaleffects` objects when available. Otherwise, the default remains 0.95.
* More informative warning for `lme4` and `glmmTMB` models with `re.form=NULL`
* `df.residual()` methods tries to call `stats::df.residual()` on the "model" attribute. If that fails or returns `NULL`, we return `Inf`.
* Column names are no longer printed by default.
* Allow multiple sequential `hypotheses()` calls. Issue 1316.
* Better parameter name labels in `get_draws()`. Thanks to andymilne for feature request 1318.
* `rvar` column from `get_draws()` is now printed by default.
* Matrix columns with 1 column are supported. Fixes errors when a variable was transformed by `scale()`, for example. Thanks to barryrowlingson for the report.
* Much faster inference with `inferences(method="boot")`. Thanks to nremenyi for issue 1352.
* `hypothesis=~pairwise` only errors when there are more than 300 comparisons. `options(marginaleffects_safe=FALSE)` to disable this check.

Bugs:

* Version 0.24.0 accidentally removed the "contrast" column from the output object in calls with only one focal predictor. This column is reinstated.
* Reinstate some attributes lost with `marginaleffects_lean` but necessary for printing.
* Encoding issue in bayesian models with `by`. Thanks to Koalha for report 1290.
* Retain necessary attribute information to ensure that "lean" return objects still print correctly 1295.
* Indexing problem with `avg_comparisons(by=data.frame())` and `avg_slopes(by=data.frame())`. Thanks to andymilne for report 1313.
* `hypotheses(p, hypothesis=~reference)` did not work for some `p` objects. Issue 1310.
* `gray` is respected for the `points` argument in `plot_*()`
* `hypotheses(x, joint=1:2)` did not work when `x` was a `marginaleffects` object. Thanks to mattansb for report 1340

0.24.0

Breaking changes in preparation for 1.0.0 release:

* Rows are now sorted when using the `by` argument. This may change the order of estimates, which can affect hypothesis tests using positional indices like `b1-b2=0`.

Bugs:

* Intercept only model now works with `avg_predictions()`. Thanks to vbrazao for report 1230.
* `systemfit` models returned no standard errors when the same variables entered in different parts of the model. Thanks to mronkko for report 1233.

New features:

* Users can reduce the size of `marginaleffects` objects by setting the new global option `options(marginaleffects_lean = TRUE)`. This will strip the return objects of all information about the original model and data, as well ancillary attributes. The benefit of dramatically smaller return objects comes at the cost of not being able to run some post-processing inference functions like `hypotheses()` on these lean objects. Thanks to grantmcdermott for the suggestion and code contribution 1267.

Misc:

* Using positional indices with `hypothesis="b1=b2"` can be dangerous if row order is modified. A warning is now issued once per session with detailed advice. This warning can be disabled with `options(marginaleffects_safe=FALSE)`.
* The `ggplot2` object returned by `plot_*()` functions now includes the estimates as a default object. This allows things like: `plot_predictions(model, condition="x")+geom_line()`. Thanks to mattansb for code contribution 1259.
* Be less strict about combining columns of different types. This allows us to handle types like `haven_labelled`. Thanks to mwindzio for report 1238.
* In `lme4` and `glmmTMB` models, warnings are now silenced when the user specifically passes `re.form=NULL`. Thanks to mattansb for the feature request.
* New startup message appears once per 24hr period and can be suppressed using `options(marginaleffects_startup_message = FALSE)`.
* `posterior_draws()` is renamed `get_draws()` because it also applies to bootstrap and simulation-based inference draws.
* `get_coef()` and `get_vcov()` are now documented on the main website, as they are useful helper functions.

0.23.0

Breaking change:

* Support for `mlogit` is deprecated. The reason is that the data structure for these models is one observation-choice per row. Every other model-fitting package supported by `marginaleffects` treats rows as individual observations. The observation-choice structure made it harder to track indices and match individual predictions to rows in the original data. This added a lot of complexity to `marginaleffects`, and the results were not always reliable or safe.

Bugs:

* Improved `glmmTMB` support
- Standard errors are produced in models with `type="zprob"`. Thanks to jgeller112 for issue 1189.
- `hypotheses()` bug resolved. Thanks to reikookamoto for the code submission.
* `multinom_weightit` models with `insight` version 0.20.4 and greater would produce an error. Thanks to Noah Greifer.
* `hypotheses(joint = TRUE)` would throw an error if sample sizes could not be computed, even if they were not needed. Thanks to Noah Greifer.
* `hypotheses(joint = TRUE)` respects the `vcov` argument. Thanks to kennchua for report 1214.
* `ordbetareg` models in `glmmTMB` are now supported. Thanks to jgeller112 for code contribution 1221.
* `tidymodels()`: Indexing overrode the value of predictors in the output data frame. The numerical estimates were unaffected. Thanks to agmath for report 1209.

0.22.0

Breaking changes:

* `type="invlink(link)"` is no longer default in `avg_predictions()` or when calling `predictions()` with the `by` argument. It is still default in `predictions()` without the `by` argument. The backtransform strategy is still available with by setting `type="invlink(link)"` explicitly.
* The `type` argument in `plot_comparisons()` now defaults to `NULL`, which is now consistent with `comparisons()` and `avg_comparisons()`. Before, the default was `type="response"`. Thanks to giakhang1906 for report 1202.

New models supported:

* `stpm2`, `pstpm2`, `gsm`, and `aft` models from `rstpm2`. Thanks to aghaynes and mclements.
* `glm_weightit`, `coxph_weightit`, `multinom_weightit`, and `ordinal_weightit` models from `Weightit`. Thanks to ngreifer.
* `glmmgee` from the `glmtoolbox` package. Thanks to adrianolszewski for the request and lhvanegasp for help with implementation.

New features:

* Parallel computation with `future` is more efficient by chunking tasks to avoid passing large objects to every worker for every future. Issue 1158.
* All columns of `newdata` are passed to the `hypothesis` function when `newdata` is supplied explicitly. Thanks to gravesti for report 1175.
* `hypotheses(joint=TRUE)`: do not call `stats::nobs()` unless necessary.
* `hypotheses()` supports formulas in the `hypothesis` argument: `hypotheses(model, hypothesis = ratio ~ reference)`
* Global option: `options("marginaleffects_print_omit" = "s.value")`
* Round significant digits for labels in `plot_predictions(mod, condition = list(x = "fivenum"))`
* `print()` no longer prints `contrast` and `term` columns when values are unique. The labels were often very long, and the content is already explicit in the call itself, so there's no ambiguity.
* No warning raised when `discrete` argument is used with `mgcv::bam` and `mgcv::gam` models objects. Thanks to Aariq for the request.
* `tidymodels` support is improved. Users can now directly feed some of them without specifying `newdata` explicitly. Thanks to davidkane9 for the feature request.

Bugs:

* Average lift and average comparisons with user-supplied functions could be be calculated incorrectly when all predictors were categorical. Thanks to Dpananos for Issue 1151.
* Indexing bug returned `NA` for some commands in `survey` models. Thanks to weikang9009 for report 1161.
* Respect default `tinytable` theme.
* Inverted confidence interval bounds with some inverse link functions. Thanks to strengejacke for report 1204.

0.21.0

New:

* `hypothesis` accepts formulas like: `ratio ~ sequential | group`
* Allow reverse binary contrasts: `comparisons(mod, variables = list(am = 1:0, vs = 0:1))`. Thanks to K. Henry for report 1137.
* `options(marginaleffects_safe = FALSE)` disables some safety checks and allows unadvisable (but potentially) useful features like *many* pairwise comparisons. Thanks to D.Locke for the feature request.
* `newdata="balanced"` is a shortcut to produce estimates at combinations of all categorical predictors, holding numeric predictors at their means. Equivalent to `datagrid(grid_type="balanced")`

Misc:

* Deprecation warning for `specify_hypothesis()`. This function was clearly marked as experimental, and has been available only for one release. It was a bad idea. Users should supply a custom function or a formula to the `hypothesis` argument. The new formula interface, in particular, makes it very easy to conduct group-wise hypothesis tests.
* Type checks are a bit looser to accommodate custom models.

Bugs:

* Fix regression in `mlogit` models due to factor conversion. This raised an error before returning result, so there is no numerical danger.
* `survey` package models work when `row.names(model)` is not coercible to integers. Thanks to ngreifer for report 1131.

Page 1 of 7

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.