Repository navigation
Breaking Changes
-
Table headers and footers are now harmonized to conceptually align with the
package documentation (see theestimateargument in?estimate_means, as
well as the vignettes on the modelization-approach
(https://easystats.github.io/modelbased/articles/post_estimation_framework.html)
and technical details on marginalization
(https://easystats.github.io/modelbased/articles/technical_marginalization.html)).
Specifically,estimatedefines the unit of interest for your estimand,
distinguishing between predictions conditioned on specific, theoretical
reference levels and marginal predictions averaged over empirical
observations at the sample or population level. Furthermore, table footers for
mixed models are now more informative, detailing how random effects are
handled. Finally, whenpredict = "inverse_link", the footer now explicitly
identifies this scale rather than printingresponse-scale. Due to Jensen's
inequality, back-transforming averaged predictions from the link scale
("inverse_link") yields different results for non-Gaussian models than
first predicting on the response scale and then averaging. -
For
estimate = "average"andestimate = "population", the default for the
predictargument for models of classglmhas changed from"inverse_link"
to"response".
Changes
-
effectsize = "emmeans"inestimate_contrasts()now also works forpolr
andclmmodels withpredict = "latent"and a logit or probit link. The
contrasts of the latent variable are divided by the SD of the latent error,
i.e.pi / sqrt(3)(logit) or1(probit). -
The
"marginaleffects"-backend now supports the ordinal family from package
glmmTMB.
Bug fixes
-
If the filter in
bykeeps one level,estimate_contrasts()with
backend = "marginaleffects"now returns contrasts of slopes for ordinal
models, such asMASS::polr()orordinal::clm(). An example is
estimate_contrasts(m, "x", by = "Infl = 'Low'"). The output compares the
slopes of the response categories at that level. Before, calls with
estimate = "typical"stopped with the error "No contrasts to show", and
calls withestimate = "average"ignored the filter. -
Fixed issue where
effectsize = "emmeans"inestimate_contrasts()returned
effect sizes in the wrong rows (e.g., when factor levels were not sorted
alphabetically) or in the wrong columns (whenbywas specified). -
Fixed issue where
effectsize = "boot"inestimate_contrasts()with
backend = "emmeans"returned effect sizes in the wrong rows, when the
contrasts were sorted in another order than in emmeans (e.g., when factor
levels were not sorted alphabetically, or for polynomial contrasts). -
The confidence intervals of effect sizes from
effectsize = "emmeans"now
use the level ofci. Before, they were always 95% intervals. -
estimate_contrasts()now gives an informative error when effect sizes are
requested for joint or omnibus tests. -
Fixed issue with wrong calculation of degrees of freedom when pooling predictions
or contrasts. -
For objects with no
dfcolumn,pool_predictions()now uses the degrees of
freedom of each object's confidence intervals. These objects come from
estimate_relation(),estimate_expectation(),estimate_prediction(),
estimate_link(), andestimate_means()withbackend = "emmeans". Before,
the pooled confidence intervals of these objects used the normal distribution
instead of the t-distribution, so they were too narrow for models with
t-statistics, such as linear models. -
Filters on the response categories of frequentist ordinal models with
backend = "emmeans", whereSatis the response:estimate_means(),estimate_contrasts()andestimate_slopes()now
also filter the response categories in a list or data-frameby, for
exampleby = list(Infl = "Low", Sat = "Low"). Before,
estimate_means()andestimate_contrasts()returned all response
categories, andestimate_slopes()gave an error. With a list, a data
frame or a formula such asby = ~ Infl + Sat, the printed output no
longer lists the response under "Predictors modulated".estimate_contrasts()now contrasts only the named response categories,
for exampleestimate_contrasts(m, "Sat = c('Low', 'High')", by = "Infl").
Before, it ignored the values and contrasted all categories. A single
category gives an error, and so does a filter on the response inby
when the response is also incontrast.- For contrasts of slopes, a filter in
bythat leaves one level to
compare, for exampleby = "Infl = 'Low'", now gives a clear error.
Before,estimate_contrasts()returned a table with empty contrasts.
-
estimate_contrasts()now applies the filter values inbyto contrasts of
slopes withestimate = "average"and withbackend = "emmeans", for
exampleestimate_contrasts(m, "wt", by = c("cyl = '4'", "am")), where
cylandamare factors. Before, these contrasts compared the slopes of
all levels and ignored the filter. Withbackend = "emmeans", the filter
applies only tobyvariables that are all factors or character vectors.
If the filter leaves fewer than two slopes to compare,
estimate_contrasts()now stops with a clear error. Multinomial models,
Bayesian ordinal models, frequentist ordinal models with
backend = "marginaleffects", and a custom hypothesis incomparison
(such as"b1 = b2", a function or a matrix), get no such check. -
p_adjust = "tukey"andp_adjust = "sidak"now give the same p-values as
emmeans inestimate_contrasts()andestimate_slopes()with
backend = "marginaleffects":- For comparisons that are not pairwise, for example
comparison = "reference"or"sequential","tukey"is replaced by
"sidak"with a message. Before, the Tukey adjustment was applied. - For slopes tested against a value other than 0, for example
hypothesis = 1, and for slopes that are not compared pairwise,"tukey"
is replaced by"sidak"with a message. Slopes compared pairwise, for
example withcomparison = ~pairwiseorpost_process = ~pairwise, keep
the Tukey adjustment. - The Tukey adjustment of slopes compared pairwise with
estimate_slopes()
now counts the slopes, not the comparisons. Before, 4 slopes were counted
as 6, the number of comparisons, which made the p-values too large. With a
group term, for examplecomparison = ~pairwise | group, the slopes and
the comparisons are counted in each group. - The Sidak adjustment of contrasts now counts the comparisons in each group
of thebyvariables. Before, it counted the levels of the contrast
variable, so for 4 levels and 6 pairwise comparisons, the p-values were
too small. A joint test, or another output with one test in each group,
is therefore no longer changed by"sidak". - A partly matched
hypothesisargument, for examplehypo = ~pairwise, is
now treated ashypothesis.
- For comparisons that are not pairwise, for example
-
estimate_slopes()withbackend = "emmeans"now appliesp_adjustfor the
stats::p.adjust()methods,"tukey"and"sidak". Before, it returned the
unadjusted p-values for every method. As inemmeans::test(),"tukey"is
replaced by"sidak"with a message, because the slopes are tested
against 0. -
Joint tests with
comparison = "joint"andbackend = "emmeans"now give
the correct statistics for contrasts between the response categories of
ordinal models, such asMASS::polr()andordinal::clm(). An example is
estimate_contrasts(m, "Sat", by = "Infl", comparison = "joint", backend = "emmeans"). Before, the F and Chi-squared statistics were wrong.
For example, they were 4 to 52 times too large for
polr(Sat ~ Infl + Type, weights = Freq, data = MASS::housing). Joint
tests of probabilities (the defaultpredict = "prob") also no longer warn
with "NaNs produced". TheChisqcolumn of joint tests with
backend = "emmeans"now prints with two decimals, andget_emcontrasts()
withcomparison = "joint"now returns a data frame that prints.