modRegGraph | R Documentation |
Function plots a moderated regression interaction diagramm and returns the coordinates of the points pred_H_mod_H pred_H_mod_L pred_L_mod_H pred_L_mod_L to be used elswhere (e.g., in another plot). H denotes high (+1 SD), L denotes low (-1 SD).
modRegGraph(
betas,
pred,
mod,
crit,
modRangeL = -1,
modRangeH = 1,
modLabSeq = 1,
plotRange = 1,
title = "",
plot = TRUE
)
betas |
Coefficients (Betas) of the moderated regression. Attribute names are used as beta labels, generated for example by coef(lm(my_model)). Attribute labels can also be used to mask variable names in a regression plot. |
pred |
String with the name of the predictor. |
mod |
String with the name of the moderator. |
crit |
String with the name of the criterium. |
modRangeL |
Lower end of the moderator to be plottet (default: -1 SD). |
modRangeH |
Upper end of the moderator to be plottet (default: 1 SD). |
modLabSeq |
Moderation label sequence (1 or 2). Cope with the lm() function, which puts out the labels in 2 different orders pred:mod (which is 1), or mod:pred (which is 2). Default is 1. |
plotRange |
Plot range of the square plot (default: 1 SD). |
title |
Title of the plot. |
plot |
Logical value if a plot should be printed (default is TRUE). |
Named vector with the four coordinates (pred_H_mod_H, pred_H_mod_L, pred_L_mod_H, pred_L_mod_L) on the y-axis for predictor at -1/1 SD and moderator at modRangeL/modRangeH SD.
Axel Zinkernagel zinkernagel@uni-landau.de
betas <- coef(lm("AutoBehav ~ IndMeasure * mod", data = df1))
modRegGraph(betas, pred = "IndMeasure", mod = "mod", crit = "AutoBehav",
title = "Title plot")
# See also vignette
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.