interactions 1.2.0

A special thanks to Github user @olivroy for contributing a number of mostly under-the-hood updates prior to this release.

Enhancements:

Bug fixes:

interactions 1.1.5

interactions 1.1.4

Bugfix:

interactions 1.1.3

Minor fix:

interactions 1.1.2

Bugfixes:

Feature update:

interactions 1.1.1

Bugfixes:

interactions 1.1.0

New function: sim_margins()

This is, as the name suggests, related to sim_slopes(). However, instead of slopes, what is being estimated are marginal effects. In the case of OLS linear regression, this is basically the same thing. The slope in OLS is the expected change in the outcome for each 1-unit increase in the predictor. For other models, however, the actual change in the outcome when there’s a 1-unit increase in a variable depends on the level of other covariates and the initial value of the predictor. In a logit model, for instance, the change in probability will be different if the initial probability was 50% (could go quite a bit up or down) than if it was 99.9% (can’t go up).

sim_margins() uses the margins package under the hood to estimate marginal effects. Unlike sim_slopes(), in which by default all covariates not involved in the interaction are mean-centered, in sim_margins() these covariates are always left at their observed values because they influence the level of the marginal effect. Instead, the marginal effect is calculated with the covariates and focal predictor (pred) at their observed values and the moderator(s) held at the specified values (e.g., the mean and 1 standard deviation above/below the mean). I advise using sim_margins() rather than sim_slopes() when analyzing models other than OLS regression.

Bug fixes

Feature updates

interactions 1.0.0

This is the first release, but a look at the NEWS for jtools prior to its version 2.0.0 will give you an idea of the history of the functions in this package.

What follows is an accounting of changes to functions in this package since they were last in jtools.

Use partial residuals for plotting

One negative when visualizing predictions alongside original data with interact_plot() or similar tools is that the observed data may be too spread out to pick up on any patterns. However, sometimes your model is controlling for the causes of this scattering, especially with multilevel models that have random intercepts. Partial residuals include the effects of all the controlled-for variables and let you see how well your model performs with all of those things accounted for.

You can plot partial residuals instead of the observed data in interact_plot() and cat_plot() via the argument partial.residuals = TRUE.

Important changes to make_predictions() and removal of plot_predictions()

In the jtools 1.0.0 release, I introduced make_predictions() as a lower-level way to emulate the functionality of effect_plot(), interact_plot(), and cat_plot(). This would return a list object with predicted data, the original data, and a bunch of attributes containing information about how to plot it. One could then take this object, with class predictions, and use it as the main argument to plot_predictions(), which was another new function that creates the plots you would see in effect_plot() et al.

I have simplified make_predictions() to be less specific to those plotting functions and eliminated plot_predictions(), which was ultimately too complex to maintain and caused problems for separating the interaction tools into a separate package. make_predictions() by default simply creates a new data frame of predicted values along a pred variable. It no longer accepts modx or mod2 arguments. Instead, it accepts an argument called at where a user can specify any number of variables and values to generate predictions at. This syntax is designed to be similar to the predictions/margins packages. See the jtools documentation for more info on this revised syntax.