lmDecomp: Decompose lm() Interactions

Description Usage Arguments Details References Examples

View source: R/lmDecomp.R

Description

This function takes the work of Bauer and Curan (2005) and applies it to a linear model object produced by lm(). Currently, the function handles two types of interactions in the lm() model: (1) Quantitative by Quantitative, which produces the Aiken and West (1991) Pick-a-Point approach simple slopes as well as Johnson-Neyman Regions-of-Significance; and (2) Quantitative by Categorical, which produces the simple slopes for the two levels of the dummy factor level as well as a quasi Region-of-Significance marking values of the Quantitative variable at which the difference of the factor levels change significance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
lmDecomp(
  obj,
  interest,
  moderator,
  mod.type = 1,
  int.values = NULL,
  mod.values = NULL,
  int.range = NULL,
  mod.range = NULL,
  alpha.level = 0.05,
  show.points = FALSE,
  print.sslopes = TRUE,
  print.ros = FALSE
)

Arguments

obj

Model object containing either a Quantitative by Quantitative interaction or a Quantitative by Categorical interaction from lm().

interest

Variable of interest in the model. Must use quotes.

moderator

Variable designated as the moderator in the model. Must use quotes.

mod.type

Defines the TYPE of interaction. Must be an integer of 1 or 2. 1 = Quantitative by Quantitative. 2 = Quantitative by Categorical. Defaults to 1.

int.values

DEPRECIATED. Set to NULL.

mod.values

Defines the values of the moderator to be used when calculating simple slopes. Only used with mod.type=1. If mod.type=2, mod.values is set to *dummy* coding (0,1), and comparison will be between indicator level and reference level in the model.

int.range

Optional. Defines the range of the variable of interest to be graphed. Only used when mod.type=2.

mod.range

Optional. Defines the range of the moderator to be graphed.

alpha.level

Designates the alpha for the Region-of-Significnace. Defaults to 0.5.

show.points

Logical. Should the original data points be shown on the produced graph? Defaults to FALSE.

print.sslopes

Logical. Should the Simple Slopes graph be created? Defaults to TRUE.

print.ros

Logical. Should the Region-of-Significance values and graph be created? Defaults to FALSE.

Details

All graphs produced are exported to the Global Environment as ggplot object which can be further edited.

References

Bauer, D.J. & Curran, P.J., (2005), Probing Interactions in Fixed and Multilevel Regression: Inferential and Graphical Techniques, Multivariate Behavioral Research, 40(3), 373–400.

Examples

1
2
3
mod <- lm(mpg ~ wt * am, data=mtcars)
summary(mod)
lmDecomp(mod, "wt", "am", mod.type = 2, mod.values=c(0,1))

MichaelJMahometa/SDSRegressionR documentation built on March 3, 2021, 10:51 p.m.