Dear lavaan community,
I am trying to perform a moderation analysis in R using SEM. However, I am not sure if the approach I have chosen suits my variables, as the latent variables in my model have a different number of indicators. I have 2 IVs: one is observational, and the other has 2 indicators; 2 moderators, one is observational and the other has 3 indicators. I feel a bit lost with the IndProd function due to the different number of indicators and if I should split the model into 2 due to too many interactions. I would appreciate any guidance, thank you. Currently the model I am trying to build looks like that
A <- paste0(1:2)
B <- paste0(3:5)
C <- paste0(6)
D <- paste0(7)
intNames <- paste0(rep(a, each = length(B)), B)
dat2 <- indProd(data1_clean, var1 = c(1:2),
var2 = c(3:5), var3 = (6), var4 = (7)
match = FALSE, residualC = TRUE,
namesProd = intNames)
### Residual Centering interaction model
modint <- '
A =~ A1 + A2
B =~ B1 + B2 + B3
DV =~ DV1 + DV2 + DV3 + DV4 + DV5
int1 =~ A1.D + A2.D
int2 =~ C:D
int3 =~ C.B1 + C.B2 + C.B3
#Fix covariances between interaction and predictors to 0
A ~~ 0*int1
D ~~ 0*int1
C ~~ 0*int2
D ~~ 0*int2
B ~~ 0*int3
C ~~ 0*int3
DV ~ A + D + Int1
DV ~ C + D + int2
DV ~ C + B + int3