simple_slopes_analysis: Simple slopes analysis

View source: R/simple_slopes_analysis.R

simple_slopes_analysisR Documentation

Simple slopes analysis

Description

Conduct a simple slopes analysis, typically to probe a two-way interaction.

Usage

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
)

Arguments

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.

Examples


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")


jinkim3/kim documentation built on Feb. 26, 2025, 10:03 a.m.