data_med_mod_ab: Sample Dataset: Simple Mediation with Both Paths Moderated...

data_med_mod_abR Documentation

Sample Dataset: Simple Mediation with Both Paths Moderated (Two Moderators)

Description

A simple mediation model with a-path and b-path each moderated by a moderator.

Usage

data_med_mod_ab

Format

A data frame with 100 rows and 7 variables:

x

Predictor. Numeric.

w1

Moderator 1. Numeric.

w2

Moderator 2. Numeric.

m

Mediator. Numeric.

y

Outcome variable. Numeric.

c1

Control variable. Numeric.

c2

Control variable. Numeric.

Examples

library(lavaan)
data(data_med_mod_ab)
data_med_mod_ab$xw1 <-
 data_med_mod_ab$x *
 data_med_mod_ab$w1
data_med_mod_ab$mw2 <-
 data_med_mod_ab$m *
 data_med_mod_ab$w2
mod <-
"
m ~ a * x + w1 + d1 * xw1 + c1 + c2
y ~ b * m + x + w1 + w2 + d2 * mw2 + c1 + c2
w1 ~~ v_w1 * w1
w1 ~ m_w1 * 1
w2 ~~ v_w2 * w2
w2 ~ m_w2 * 1
ab := a * b
ab_lolo := (a + d1 * (m_w1 - sqrt(v_w1))) * (b + d2 * (m_w2 - sqrt(v_w2)))
ab_lohi := (a + d1 * (m_w1 - sqrt(v_w1))) * (b + d2 * (m_w2 + sqrt(v_w2)))
ab_hilo := (a + d1 * (m_w1 + sqrt(v_w1))) * (b + d2 * (m_w2 - sqrt(v_w2)))
ab_hihi := (a + d1 * (m_w1 + sqrt(v_w1))) * (b + d2 * (m_w2 + sqrt(v_w2)))
"
fit <- sem(mod, data_med_mod_ab,
           meanstructure = TRUE, fixed.x = FALSE)
parameterEstimates(fit)[c(1, 3, 6, 10, 41:45), ]

manymome documentation built on Oct. 4, 2024, 5:10 p.m.