Learn R Programming

manymome (version 0.3.7)

data_mod_2x2w: Sample Dataset: Two Moderators on Two Predictors

Description

A two-moderator model, with the moderators affecting the effects of different predictors.

Usage

data_mod_2x2w

Arguments

Format

A data frame with 200 rows and 6 variables:

y

Outcome variable. Numeric.

x1

Predictor 1. Numeric.

x2

Predictor 2. Numeric.

w1

Moderator 1. Numeric.

w2

Moderator 2. Numeric.

c1

Control variable. Numeric.

c2

Control variable. Numeric.

Examples

Run this code
library(lavaan)
data(data_mod_2x2w)
lm_out <- lm(y ~ x1*w1 + x2*w2 + c1 + c2, data_mod_2x2w)
out1 <- cond_effects(
  wlevels = "w1",
  x = "x1",
  fit = lm_out
)
out1
plot(out1, graph_type = "tumble")

out2 <- cond_effects(
  wlevels = "w2",
  x = "x2",
  fit = lm_out
)
out2
plot(out2, graph_type = "tumble")

Run the code above in your browser using DataLab