Hello,
I have created a SEM with direct and indirect effects, it works like magic. But now I'd like to plot the moderation effects, like in the picture (which is symbolic):
The plot in the picture was created by plotMod(), but this only works with lm().
So, my questions:
1. Can I plot the moderation effrect with the fit results begotten from lavaan?
2. If this is not possible, I would use poltMod(), but the problem is how to transform my regression code into one fit for lm()? Can someone please help? Thank you!
Here is the code:
SEM_model4<-'
#regressions model
ZEA4items~b1*ZEC3dim+b2*ZESEsum+b3*ZESExZEC
ZEA2~c*ZEA4items+a1*ZEC3dim+a2*SPOL+a3*DRUZ_BINAR#+e*ZESEsum
#covariances
ZEC3dim~~ZESExZEC
ZEC3dim~~ZESEsum
ZESEsum~~ZESExZEC
#variances
DRUZ_BINAR~~DRUZ_BINAR
SPOL~~SPOL
ZEA2~~ZEA2
ZEC3dim~~ZEC3dim
ZESEsum~~ZESEsum
ZEA4items~~ZEA4items
ZESExZEC~~ZESExZEC
# key
## IV - ZEC3dim
## Z - ZESExZEC
## M - ZEA4items
## DV - ZEA2
## ESE - ZESEsum
## SPOL - SPOL
## DRUZ - DRUZ_BIN
#indirect
indirect_IV_M_DV:=b1*c
indirect_Z_M_DV:=b3*c
indirect_ESE_M_DV:=b2*c
#direct
direct_M_DV:=c
direct_Z_M:=b3
direct_IV_M:=b1
direct_ESE_M:=b2
direct_IV_DV:=a1
direct_SPOL_DV:=a2
direct_DRUZ_DV:=a3
#total
Total_IV_DV:=b1*c+a1
Total_Z_DV:=b3*c+0
'