Description Usage Arguments Value Examples
View source: R/moderation_plot.r
This functions creates a conditional effect plot that illustrates how an effect of x on y changes with changes in a continuous moderator variable.
1 2 3 4 5 6 7 8 9 | moderation_plot(
object,
x = NULL,
m = NULL,
x_lab = "Moderator",
y_lab = "Conditional effect of x on y",
quantil = 100,
mod_hist = TRUE
)
|
object |
An object of class |
x |
The name of the predictor variable. |
m |
The name of the continuous moderator variable. |
x_lab |
A character value specifying the x label in the final plot. |
y_lab |
A character value specifying the y label in the final plot. |
quantil |
Number of quantiles that should be calculated. |
mod_hist |
A logical value indicating whether a histogram of the moderator variable should be added above the moderation plot. |
If mod_hist = TRUE, this function returns a "ggExtraPlot" (i.e. a "gtable"). If mod_hist = FALSE, it returns a ggplot object that can be further customized using standard ggplot elements.
1 2 3 4 5 6 7 8 9 10 11 12 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.