- Thanks to Narwhals, marginaleffects can now ingest data frames in multiple formats and convert them to the Polars representation that we need internally. This no longer requires external dependencies like Pandas or DuckDB. Thanks to @artiom-matvei.
- Formulas should not include scale() or center(). Thanks to @alexjonesphd for reporting Issue #113.
Breaking change:
hypothesis
andhypothesis
now index in a Python-like style by counting from 0 instead of counting from 1 as in R. Example code before the changepredictions(mod, hypothesis = "b1 - b2 = 0")
; example correct code after changepredictions(mod, hypothesis = "b0 - b1 = 0")
- Bug in datagrid() prevented "balanced" grid type. Thanks to @danielkberry for the fix (PR #104).
- Bug: Missing values leading to ValueError: "Something went wrong" in predictions() (Issue #83)
- Workaround for upstream regression in Polars.
- Bugfix for p value calculation in equivalence tests. Results could be incorrect.
- Polars 0.20.7 introduced a breaking change by error. Pinning version until thi is fixed. pola-rs/polars#14401
- Issue #90: Informative error on reserved keyword like 'group'.
- Issue #91: get_variables_names() in class ModelStatsmodels does not return all variables which causes errors
- PyFixest: Fixed effects variables are recognized as categorical by
datagrid()
MarginalEffectsDataFrame
class now has ajacobian
attribute.
Breaking change:
datagridcf()
is deprecated. Usedatagrid(grid_type='counterfactual')
instead.
New:
- Support the
PyFixest
package. https://s3alfisc.github.io/pyfixest/
datagrid()
no longer requires specifying themodel
argument when called inside another marginaleffects function likepredictions()
.
eps_vcov
argument to control the step size in the computation of the Jacobian used for standard errors.- plot_*() use
plotnine
instead of rawmatplotlib
- plot_*()
condition
argument gets string shortcuts for numeric variables: "threenum", "fivenum", "minmax". datagrid()
gets agrid_type
argument: 'mean_or_mode', 'balance', 'counterfactual'- Plot labels are sorted for clarity and consistency.
hypotheses()
function now supports raw models for conducting (non)-linear hypothesis tests on coefficients.
Misc:
- Refactor and several bug fixes in the
plot_*()
functions. - Many bug fixes.
- Upgraded dependency on the
polars
package, with a shift from.apply()
to.map_*()
due to deprecation. - Removed
pandas
dependency.
hypothesis
accepts a float or integer to specify a different null hypothesis.- Better column order in printout when using
datagrid()
orby
- Version bump for dependencies.
- Equivalence test bug with duplicated column names.
- Minor bugs in plot_*() with unknown consequences.
- Linting.
predictions()
supports categorical predictors whennewdata
does not include all levels (internal padding).- Better sorting of output, using the
by
argument.
- New function:
datagridcf()
predictions()
supports categorical predictors whennewdata
does not include all levels (internal padding).
Breaking change:
- Rename argument to match
R
marginaleffects
:conf_int
->conf_level
Misc:
MarginaleffectsDataFrame
class inherits frompl.DataFrame
for better printing and to host useful attributes.
Misc:
- Better step size selection for the numerical derivatives used to compute delta method standard errors.
Bugs:
- When newdata was an unseen dataframe, out.columns would be referenced in sanity.py prior to assignment. Thanks to @Vinnie-Palazeti for PR #25.
Initial release