- Some function arguments will be renamed, to achieve consistency across the package and across other packages where I’m involved in the development. This will be a soft transition, i.e. the old argument names will still work for some package updates.
typicalargument now supports a mix of functions for different variable types at which numeric or categorical covariates (non-focal terms) are held constant.
Clarification of how the
re.formargument is set when using
type = "random"resp.
type = "fixed"in
- Fixed issue in
hypothesis_test()for mixed models, which sometimes failed when random effects group variables were numeric, and not factors.
CRAN release: 2023-09-05
johnson_neyman(), to create Johnson-Neyman intervals and plots from
Better automatic handling of offset-terms, both for predictions and generating plots with raw data. When the model formula contains an offset-term, and the offset term is fixed at a specific value, the response variable is now automatically transformed back to the original scale, and the offset-term is added to the predicted values. A warning is printed when model contains transformed offset-terms that are not fixed, e.g. via the
CRAN release: 2023-08-21
- To avoid confusion when adding raw data or residuals to plots, the
jitterargument that is used to add some noice to data points to avoid overlapping now defaults to
NULL. Formerly, a small jitter was added by default, leading to confusion when data points did not match the original data.
plot()method gets a
label.dataargument, to add row names to data points when
add.data = TRUE.
tibblesare always converted into data frames, to avoid issues.
byargument, to specify a variable that is used to group the comparisons or contrasts. This is useful for models with interaction terms.
Plotting residuals did not work when model object passed to
ggpredict()were inside a list, or when called from inside functions (scoping issues).
Fixed issue where plotting raw data (i.e.
plot(..., add.data = TRUE)) did not work when there were missing data in weight variables (i.e. when the regression model used weights).
Fixed issues with robust estimation for models of package pscl.
Fixed issues introduced by breaking changes in marginaleffects.
CRAN release: 2023-06-11
scaleargument, to explicitely modulate the scale of the contrasts or comparisons (e.g.
"exp"to return transformed contrasts/comparisons).
hyothesis_test()now includes the response level for models with ordinal outcomes (and alike).
ggpredict()is used inside functions and a name for a vector variable (passed as argument to that function) in
termsis used, the variable is now correctly recognized.
Partial residuals (when
plot(..., residuals = TRUE)) now supports more linear (mixed) models, including models from package lme (such as
For mixed models,
type = "random"used to calculate prediction intervals that always accounted for random effects variances, leading to larger intervals. Using
interval = "confidence"together with
type = "random"now allows to calculate “usual” confidence intervals for random effects. This is usefule for predictions at specific group levels of random effects (when focal terms are only fixed effects, use
type = "fixed"for regular confidence intervals).
vcov.funargument can now also be a function that returns a variance-covariance matrix.
print()method now shows all rows by default when the focal term is a factor. If rows are not shown in the output, a message is printed to inform the user about truncated output.
A new vignette about using ggeffects in the context of an intersectional multilevel analysis of individual heterogeneity, using the MAIHDA framework.
CRAN release: 2023-05-04
Added a new
[.ggeffectsfunction, which allows to subset
ggeffectsobjects in the same way as regular data frames, i.e. it is now possible to do:
Using a name for a vector variable in
termsnow works from inside functions. E.g., you can now do:
plot()can now also be applied to single-colored plots.
collapse_levelargument, to collapse term labels that refer to the same levels into a singel unique level string.
Fixed issue with misplaced residuals when x-axis was categorical and the factor levels were not in alphabetical order.
pool_predictions()now correctly handles models with transformed response variables (like
log(y)) and returns the correct back-transformed pooled predictions (and their confidence intervals).
Fixed issue with wrong computation of confidence intervals for models of class
clmfrom package ordinal.
Fixed failing tests due to changes in the logistf package, which now also supports emmeans. That means,
ggemmeans()now also works for models from package logistf.
Fixed bug in
plot()when partial residuals were added (i.e.
residuals = TRUE) and
collapse.groupwas provided (in case of mixed models).
Fixed issue with wrong labels in
hyothesis_test()for comparisons with many rows, when betas starting with same digit were specified (e.g.
test = "(b1-b13)=(b3-b15)").
Fixed issue in
hyothesis_test()for mixed models when focal terms included factors with factor levels that contained a comma.
Fixed issue with missing confidence intervals for mixed models when one of the variable names contains white space characters (e.g.
y ~ 'x a' + xb).
CRAN release: 2023-04-02
equivalenceargument, to compute tests of practical equivalence for contrasts and comparisons.
The message whether contrasts or comparisons from
hypothesis_test()are on the link-scale is now printed below the table.
- Fixed issues in
hypothesis_test()for mixed models with one focal term only, and when this term was categorical.
CRAN release: 2023-02-24
- Confidence intervals of adjusted predictions now take the model’s degrees of freedom into account, thereby leading to slightly larger intervals for models that do not have infinite degrees of freedom (like linear models with t-statistic).
hypothesis_test(), to compute contrasts and comparisons of predictions and test differences for statistical significance. Additionally, an accompanying vignette that explains the new function in detail is added.
install_latest(), to install the latest official package version from CRAN, or the latest development version from r-universe.
termsargument can now also be a named list. Thus, instead of
terms = c("score [30,50,70]", "status [low, middle]")one could also write
terms = list(score = c(30,50,70), status = c("low", "middle")).
CRAN release: 2023-01-25
CRAN release: 2022-10-23
- Reduced package dependencies. Packages sjlabelled and MASS were moved from imports to suggests. ggeffects is now a very lightweight package to compute adjusted predictions and estimated marginal means.
Fixed issue with wrong standard errors for predicting random effect groups for more multiple levels.
Fixed issue in
ggemmeans(), which did not correctly averaged over character vectors when these were hold constant.
Fixed bug for models of class
type = "re"was requested.
CRAN release: 2022-08-07
CRAN release: 2022-04-10
CRAN release: 2021-07-29
- Add more informative error message for brmsfit models using
mo()with numeric predictors, which only allow to predict for values that are actually present in the data.
CRAN release: 2021-04-30
Prediction intervals (where possible, or when
type = "random"), are now always based on sigma^2 (i.e.
insight::get_sigma(model)^2). This is in line with
interval = "prediction"for lm, or for predictions based on simulations (when
type = "simulate").
print()now uses the name of the focal variable as column name (instead) of
collapse_by_group(), to generate a data frame where the response value of the raw data is averaged over the levels of a (random effect) grouping factor.
A new vignette was added related to the definition and meaning of “marginal effects” and “adjusted predictions”. To be more strict and to avoid confusion with the term “marginal effect”, which meaning may vary across fields, either “marginal effects” was replaced by “adjusted predictions”, or “adjusted predictions” was added as term throughout the package’s documentation and vignettes.
Allow confidence intervals when predictions are conditioned on random effect groups (i.e. when
type = "random"and
termsincludes a random effect group factor).
ggpredict()now computes confidence intervals for some edge cases where it previously failed (e.g. some models that do not compute standard errors for predictions, and where a factor was included in the model and not the focal term).
collapse.groupargument, which - in conjunction with
add.data- averages (“collapses”) the raw data by the levels of the group factors (random effects).
Fixed issue in
Fixed issue with
type = "simulate"for
Fixed issue with
gamlssmodels that had
random()function in the model formula.
Fixed issue with incorrect back-transformation of predictions for
CRAN release: 2021-03-17
plot()is deprecated. Always using
CRAN release: 2020-12-14
- Fixed CRAN check issues.
- Added argument
ggemmeans(), to either compute confidence or prediction intervals.
CRAN release: 2020-11-29
pool_predictions(), to pool multiple
ggeffectsobjects. This can be used when predicted values or estimated marginal means are calculated for models fit to multiple imputed datasets.
- The function
residualize_over_grid()is now exported.
- The back-transformation of the response-variable (if these were log- or square root-transformed in the model) now also works with square root-transformations and correctly handles
log(mu + x).
- Since standard errors were on the link-scale and not back-transformed for non-Gaussian models, these are now no longer printed (to avoid confusion between standard errors on the link-scale and predictions and confidence intervals on the response-scale).
- Fixed issue for mixed models when predictions should be conditioned on random effects variances (e.g.
type = "random"or
"zi_random"), but random effects variances could not be calculated or were almost zero.
- Fixed issue with confidence intervals for
- Fixed issue in
ggemmeans()for models from nlme.
- Fixed issue with
plot()for some models in
- Fixed issue with computation of confidence intervals for zero-inflated models with offset-term.
CRAN release: 2020-09-13
- Package insight since version 0.9.5 now returns the “raw” (untransformed, i.e. original) data that was used to fit the model also for log-transformed variables. Thus, exponentiation like using
terms = "predictor [exp]"is no longer necessary.
plot()now can also create partial residuals plots. There, arguments
residuals.linewere added to add partial residuals, the type of residuals and a possible loess-fit regression line for the residual data.
- The message for models with a back-transformation to the response scale (all non-Gaussian models), that standard errors are still on the link-scale, did not show up for models of class
glmsince some time. Should be fixed now.
- Fixed issue with
rlmerModsmodels when using factors as adjusted terms.
- Fixed issue with brms-multi-response models.
CRAN release: 2020-07-27
- Fixed issues due to latest rstanarm update.
- Fixed some issues around categorical/cumulative brms models when the outcome is numeric.
- Fixed bug with factor level ordering when plotting raw data from
CRAN release: 2020-06-16
ggpredict()gets a new
"zi.prob", to predict the zero-inflation probability (for models from pscl, glmmTMB and GLMMadaptive).
- When model has log-transformed response variable and
add.data = TRUEin
plot(), the raw data points are also transformed accordingly.
add.data = TRUEfirst adds the layer with raw data, then the points / lines for the marginal effects, so raw data points to not overlay the predicted values.
terms-argument now also accepts the name of a variable to define specific values. See vignette Marginal Effects at Specific Values.
CRAN release: 2020-04-20
CRAN release: 2020-03-14
- ggeffects now requires glmmTMB version 1.0.0 or higher.
- Added human-readable alias-options to the
- Fixed issue when log-transformed predictors where held constant and their typical value was negative.
- Fixed issue when plotting raw data to a plot with categorical predictor in the x-axis, which had numeric factor levels that did not start at
- Fixed issues for model objects that used (log) transformed
CRAN release: 2020-01-28
CRAN release: 2019-12-16
- Reduce package dependencies.
plot(rawdata = TRUE)now also works for objects from
ggpredict()now computes confidence intervals for predictions from
- For brmsfit models with
trials()as response variable,
ggpredict()used to choose the median value of trials were the response was hold constant. Now, you can use the
condition-argument to hold the number of trials constant at different values.
- Fixed issue with
clmm-models, when group factor in random effects was numeric.
- Raw data is no longer omitted in plots when grouping variable is continuous and added raw data doesn’t numerically match the grouping levels (e.g., mean +/- one standard deviation).
- Fix CRAN check issues due to latest geepack update.
CRAN release: 2019-11-08
brmultinom(package brglm2) and models from packages bamlss and R2BayesX.
- Updated package dependencies.
plot()now uses dodge-position for raw data for categorical x-axis, to align raw data points with points and error bars geoms from predictions.
- Updated and re-arranged internal color palette, especially to have a better behaviour when selecting colors from continuous palettes (see
- Added a
vcov()function to calculate variance-covariance matrix for marginal effects.
- Fixed issue with wrong order of plot x-axis for
ggeffect(), when one term was a character vector.
CRAN release: 2019-09-03
ggpredict()now supports cumulative link and ordinal vglm models from package VGAM.
- More informative error message for clmm-models when
termsincluded random effects.
add.datais an alias for the
ggemmeans()now also support predictions for gam models from
CRAN release: 2019-07-01
- Revised docs and vignettes - the use of the term average marginal effects was replaced by a less misleading wording, since the functions of ggeffects calculate marginal effects at the mean or at representative values, but not average marginal effects.
- Replace references to internal vignettes in docstrings to website-vignettes, so links on website are no longer broken.
values_at()is an alias for
ggpredict()now supports prediction intervals for models from MCMCglmm.
back.transform-argument, to tranform predicted values from log-transformed responses back to their original scale (the default behaviour), or to allow predictions to remain on log-scale (new).
ggemmeans()now can calculate marginal effects for specific values from up to three terms (i.e.
termscan be of lenght four now).
plot()now also applies to error bars for categorical variables on the x-axis.
CRAN release: 2019-05-13
- Better support, including confidence intervals, for some of the already supported model types.
- New package-vignette Logistic Mixed Effects Model with Interaction Term.
- The steps for specifying a range of values (e.g.
terms = "predictor [1:10]") can now be changed with
terms = "predictor [1:10 by=.5]"(see also vignette Marginal Effects at Specific Values).
- Robust standard errors for predictions (see argument
ggpredict()) now also works for following model-objects:
polr(and probably also
gls, not tested yet).
interval-argument, to compute prediction intervals instead of confidence intervals.
plot.ggeffects()now allows different horizontal and vertical jittering for
jitteris a numeric vector of length two.
- Models with
AsIs-conversion from division of two variables as dependent variable, e.g.
I(amount/frequency), now should work.