data_med_mod_ab1: Sample Dataset: Simple Mediation with Both Paths Moderated By...

data_med_mod_ab1R Documentation

Sample Dataset: Simple Mediation with Both Paths Moderated By a Moderator

Description

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

Usage

data_med_mod_ab1

Format

A data frame with 100 rows and 6 variables:

x

Predictor. Numeric.

w

Moderator. Numeric.

m

Mediator. Numeric.

y

Outcome variable. Numeric.

c1

Control variable. Numeric.

c2

Control variable. Numeric.

Examples

library(lavaan)
data(data_med_mod_ab1)
data_med_mod_ab1$xw <-
 data_med_mod_ab1$x *
 data_med_mod_ab1$w
data_med_mod_ab1$mw <-
 data_med_mod_ab1$m *
 data_med_mod_ab1$w
mod <-
"
m ~ a * x + w + da * xw + c1 + c2
y ~ b * m + x + w + db * mw + c1 + c2
w ~~ v_w * w
w ~ m_w * 1
ab := a * b
ab_lo := (a + da * (m_w - sqrt(v_w))) * (b + db * (m_w - sqrt(v_w)))
ab_hi := (a + da * (m_w + sqrt(v_w))) * (b + db * (m_w + sqrt(v_w)))
"
fit <- sem(mod, data_med_mod_ab1,
           meanstructure = TRUE, fixed.x = FALSE)
parameterEstimates(fit)[c(1, 3, 6, 9, 38:40), ]

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