two_way_interaction_plot {psycModel} | R Documentation |
Two-way Interaction Plot
Description
The function creates a two-way interaction plot. It will creates a plot with ± 1 SD from the mean of the independent variable. See supported model below.
I recommend using concurrently with lm_model
or lme_model
.
Usage
two_way_interaction_plot(
model,
data = NULL,
graph_label_name = NULL,
cateogrical_var = NULL,
y_lim = NULL,
plot_color = FALSE
)
Arguments
model |
object from |
data |
|
graph_label_name |
vector of length 3 or function. Vector should be passed in the form of |
cateogrical_var |
list. Specify the upper bound and lower bound directly instead of using ± 1 SD from the mean. Passed in the form of |
y_lim |
the plot's upper and lower limit for the y-axis. Length of 2. Example: |
plot_color |
default if |
Details
It appears that “predict' cannot handle categorical factors. All variables are converted to numeric before plotting.
Value
an object of class ggplot
Examples
lm_fit <- lm(Sepal.Length ~ Sepal.Width * Petal.Width,
data = iris
)
two_way_interaction_plot(lm_fit, data = iris)