The function uses the interaction::sim_slopes() to calculate the slope estimate at varying level of moderators (+/- 1 SD and mean). Additionally, it will produce a Johnson-Newman plot that shows when the slope estimate is not significant

simple_slope(
  data,
  model,
  two_way_interaction_factor = NULL,
  three_way_interaction_factor = NULL
)

Arguments

data

data frame

model

model object from lm, lme,lmer

two_way_interaction_factor

vector of character of the two_way_interaction_factor

three_way_interaction_factor

vector of character of the three_way_interaction_factor

Value

a list with the slope estimate data frame and a Johnson-Newman plot.

Examples

fit <- lm_model(
  data = iris,
  response_variable = Sepal.Length,
  predictor_variable = tidyselect::everything(),
  three_way_interaction_factor = c(Sepal.Width, Petal.Width, Petal.Length)
)
#> Warning: The following columns are coerced into numeric: Species
#> Fitting Model with lm:
#>  Formula = Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species + Sepal.Width*Petal.Width*Petal.Length

simple_slope_fit <- simple_slope(
  data = iris,
  model = fit,
  three_way_interaction_factor = c("Sepal.Width", "Petal.Width", "Petal.Length")
)