View source: R/simple_slopes_analysis.R
| simple_slopes_analysis | R Documentation |
Conduct a simple slopes analysis, typically to probe a two-way interaction. (This function was edited with ChatGPT on Dec 13, 2025.)
simple_slopes_analysis(
data = NULL,
iv_name = NULL,
dv_name = NULL,
mod_name = NULL,
round_focal_value = 2,
round_b = 2,
round_se = 2,
round_t = 2,
round_p = 3,
focal_values = NULL
)
data |
a data object (a data frame or a data.table) |
iv_name |
name of the independent variable (IV) |
dv_name |
name of the dependent variable (DV) |
mod_name |
name of the moderator variable (MOD) |
round_focal_value |
number of decimal places to which to round the focal values (default = 2) |
round_b |
number of decimal places to which to round coefficients from the regression analysis (default = 2) |
round_se |
number of decimal places to which to round standard error values from the regression analysis (default = 2) |
round_t |
number of decimal places to which to round t statistics from the regression analysis (default = 2) |
round_p |
number of decimal places to which to round p values from the regression analysis (default = 2) |
focal_values |
this input will be used only in cases where moderator is continuous. In such cases, what are the focal values of the moderator at which to estimate the effect of IV on DV? By default, values corresponding to the mean of MOD, and mean of MOD +/-1 SD will be used. |
simple_slopes_analysis(
data = mtcars, iv_name = "vs", dv_name = "mpg", mod_name = "am")
simple_slopes_analysis(
data = mtcars, iv_name = "vs", dv_name = "mpg", mod_name = "hp")
simple_slopes_analysis(
data = mtcars, iv_name = "disp", dv_name = "mpg", mod_name = "hp")
simple_slopes_analysis(
data = mtcars, iv_name = "vs", dv_name = "am", mod_name = "hp")
simple_slopes_analysis(
data = mtcars, iv_name = "disp", dv_name = "am", mod_name = "hp")
# when the iv is a factor
simple_slopes_analysis(
data = ToothGrowth, iv_name = "supp", dv_name = "len", mod_name = "dose")
# from the example above, switch the iv and moderator
simple_slopes_analysis(
data = ToothGrowth, iv_name = "dose", dv_name = "len", mod_name = "supp")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.