Learn R Programming

manymome (version 0.2.7)

data_med_complicated_mg: Sample Dataset: A Complicated Mediation Model With Two Groups

Description

A mediation model with two predictors, two pathways, and two groups.

Usage

data_med_complicated_mg

Arguments

Format

A data frame with 300 rows and 5 variables:

x1

Predictor 1. Numeric.

x2

Predictor 2. Numeric.

m11

Mediator 1 in Path 1. Numeric.

m12

Mediator 2 in Path 1. Numeric.

m2

Mediator in Path 2. Numeric.

y1

Outcome variable 1. Numeric.

y2

Outcome variable 2. Numeric.

c1

Control variable. Numeric.

c2

Control variable. Numeric.

group

Group variable. Character. 'Group A' or 'Group B'

Examples

Run this code
library(lavaan)
data(data_med_complicated_mg)
dat <- data_med_complicated_mg
mod <-
"
m11 ~ x1 + x2 + c1 + c2
m12 ~ m11 + c1 + c2
m2 ~ x1 + x2 + c1 + c2
y1 ~ m11 + m12 + x1 + x2 + c1 + c2
y2 ~ m2 + x1 + x2 + c1 + c2
"
fit <- sem(mod, dat, group = "group")
summary(fit)

Run the code above in your browser using DataLab