View source: R/johnson_neyman.R
johnson_neyman | R Documentation |
Function conduct a spotlight-analysis to create so-called
Johnson-Neyman intervals. The plot()
method can be used to visualize the
results of the Johnson-Neyman test.
johnson_neyman(x, precision = 500, ...)
spotlight_analysis(x, precision = 500, ...)
## S3 method for class 'ggjohnson_neyman'
plot(
x,
colors = c("#f44336", "#2196F3"),
show_association = TRUE,
show_rug = FALSE,
verbose = TRUE,
...
)
x |
An object of class |
precision |
Number of values used for the range of the moderator variable
to calculate the Johnson-Neyman interval. This argument is passed down to
|
... |
Arguments passed down to |
colors |
Colors used for the plot. Must be a vector with two color
values. Only used if |
show_association |
Logical, if |
show_rug |
Logical, if |
verbose |
Show/hide printed message for plots. |
The Johnson-Neyman intervals help to understand where slopes are significant
in the context of interactions in regression models. Thus, the interval is only
useful if the model contains at least one interaction term. The function
accepts the results of a call to ggpredict()
, ggeffect()
or ggemmeans()
.
The first and the last focal term used in the terms
argument of
ggpredict()
etc. must be numeric. The function will then test the slopes of
the first focal terms against zero, for different moderator values of the
last focal term. Use plot()
to create a plot of the results.
To avoid misleading interpretations of the plot, we speak of "positive" and "negative" associations, respectively, and "no clear" associations (instead of "significant" or "non-significant"). This should prevent the user from considering a non-significant range of values of the moderator as "accepting the null hypothesis".
A Johnson-Neyman plot.
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. doi: 10.1207/s15327906mbr4003_5
Esarey, J., & Sumner, J. L. (2017). Marginal effects in interaction models: Determining and controlling the false positive rate. Comparative Political Studies, 1–33. Advance online publication. doi: 10.1177/0010414017730080
Johnson, P.O. & Fay, L.C. (1950). The Johnson-Neyman technique, its theory and application. Psychometrika, 15, 349-367. doi: 10.1007/BF02288864
McCabe CJ, Kim DS, King KM. Improving Present Practices in the Visual Display of Interactions. Advances in Methods and Practices in Psychological Science. 2018;1(2):147-165. doi:10.1177/2515245917746792
Spiller, S. A., Fitzsimons, G. J., Lynch, J. G., & McClelland, G. H. (2013). Spotlights, Floodlights, and the Magic Number Zero: Simple Effects Tests in Moderated Regression. Journal of Marketing Research, 50(2), 277–288. doi:10.1509/jmr.12.0420
## Not run:
data(efc)
efc$c172code <- as.factor(efc$c172code)
m <- lm(neg_c_7 ~ c12hour * barthtot * c172code, data = efc)
pr <- ggpredict(m, c("c12hour", "barthtot"))
johnson_neyman(pr)
plot(johnson_neyman(pr))
pr <- ggpredict(m, c("c12hour", "c172code", "barthtot"))
johnson_neyman(pr)
plot(johnson_neyman(pr))
# robust standard errors
if (requireNamespace("sandwich")) {
johnson_neyman(pr, vcov = sandwich::vcovHC)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.