Strukturgleichungsmodelle mit R lavaan
6. Modellierung nicht-linearer Zusammenhänge im SEM

Arndt Regorz, Dipl. Kfm. & MSc. Psychologie, 17.01.2024

Dies ist eine Begleitseite zum Video-Tutorial, wie man mit lavaan einen nicht-linearen (hier: quadratischen) Zusammenhang zwischen latenten Variablen modellieren kann.

R-Code

library(lavaan)

head(simulation_data, 5)

with(simulation_data, plot(IV, DV))

# 1. True Relationship

simulation_data$IV_SQ <- (simulation_data$IV)^2

true_model <- '
DV ~ IV + IV_SQ'

fit_true <- sem(model = true_model, data=simulation_data)
summary(fit_true, standardized = T)

# 2. Product Indicators in Lavaan

attach(simulation_data)
simulation_data$IV1_sq <- IV1 * IV1
simulation_data$IV2_sq <- IV2 * IV2
simulation_data$IV3_sq <- IV3 * IV3
simulation_data$IV4_sq <- IV4 * IV4
detach(simulation_data)

model_prod <- '
IV_lat =~ IV1 + IV2 + IV3 + IV4
IV_lat_sq =~ IV1_sq + IV2_sq + IV3_sq + IV4_sq
DV_lat =~ DV1 + DV2 + DV3 + DV4

IV1_sq ~~ IV1
IV2_sq ~~ IV2
IV3_sq ~~ IV3
IV4_sq ~~ IV4
IV_lat ~~ IV_lat_sq

DV_lat ~ IV_lat + IV_lat_sq
'

fit_prod <- sem(model=model_prod, data= simulation_data)
summary(fit_prod, fit.measures = T, standardized = T)