I was able to use the following code to run a moderated mediation model with 5 mediators in parallel and a categorical moderator with 4 groups. (I've removed the code to determine the indirect effects and total effect)
zmod<-'
Y~c(a1,a2,a3,a4)*M1+c(b1,b2,b3,b4)*M2+c(c1,c2,c3,c4)*M3+c(d1,d2,d3,d4)*M4+c(j1,j2,j3,j4)*M5+c(i1,i2,i3,i4)*X
M1~c(e1,e2,e3,e4)*X
M2~c(f1,f2,f3,f4)*X
M3~c(g1,g2,g3,g4)*X
M4~c(h1,h2,h3,h4)*X
M5~c(k1,k2,k3,k4)*X'
zfitmod<-sem(zmod, se="bootstrap", data=Data, group="W")
summary(zfitmod)
My goal now is to run a similar model that includes serial mediation as well as parallel mediation. The path would be X->M1+M2+M3->M4->Y (see image) with W as a categorical moderator for each path. Is it possible to run this using lavaan?
Thank you,
Lauren