johnson_neyman
finds so-called "Johnson-Neyman" intervals for
understanding where simple slopes are significant in the context of
interactions in multiple linear regression.
johnson_neyman(model, pred, modx, vmat = NULL, alpha = 0.05, plot = TRUE)
A regression model of type lm
or svyglm
.
It should contain the interaction of interest.
The predictor variable involved in the interaction.
The moderator variable involved in the interaction.
Optional. You may supply the variance-covariance matrix of the coefficients yourself. This is useful if you are using robust standard errors, as you could if using the sandwich package.
The alpha level. By default, the standard 0.05.
Should a plot of the results be printed? Default is TRUE
.
The ggplot2
object is returned either way.
The two numbers that make up the interval.
A dataframe with predicted values of the predictor's slope and lower/upper bounds of confidence bands if you would like to make your own plots
The ggplot
object used for plotting. You can tweak the
plot like you could any other from ggplot
.
The interpretation of the values given by this function is important and not always immediately intuitive. For an interaction between a predictor variable and moderator variable, it is often the case that the slope of the predictor is statistically significant at only some values of the moderator. For example, perhaps the effect of your predictor is only significant when the moderator is set at some high value.
The Johnson-Neyman interval provides the two values of the moderator at which the slope of the predictor goes from non-significant to significant. Usually, the predictor's slope is only significant outside of the range given by the function. The output of this function will make it clear either way.
This technique is not easily ported to 3-way interaction contexts. You could,
however, look at the J-N interval at two different levels of a second
moderator. This does forgo a benefit of the J-N technique, which is not
having to pick arbitrary points. If you want to do this, just use the
sim_slopes
function's ability to handle 3-way interactions
and request Johnson-Neyman intervals for each.
Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and multilevel regression: Inferential and graphical techniques. Multivariate Behavioral Research, 40(3), 373-400. http://dx.doi.org/10.1207/s15327906mbr4003_5
Johnson, P.O. & Fay, L.C. (1950). The Johnson-Neyman technique, its theory and application. Psychometrika, 15, 349-367. http://dx.doi.org/10.1007/BF02288864
Other interaction tools: interact_plot
,
probe_interaction
, sim_slopes
# NOT RUN {
# Using a fitted lm model
states <- as.data.frame(state.x77)
states$HSGrad <- states$`HS Grad`
fit <- lm(Income ~ HSGrad + Murder*Illiteracy,
data = states)
johnson_neyman(model = fit, pred = Murder,
modx = Illiteracy)
# }
Run the code above in your browser using DataLab