Dear list members,
I wonder whether I could run a mediation Analysis including latent variables in blavaan, such as it is easily implemented with lavaan :
library(lavaan)
model <- '
# latent variables
X =~ x1 + x2 + x3
M =~ y1 + y2 + y3 + y4
Y =~ y5 + y6 + y7 + y8
fit <- sem(model,data=PoliticalDemocracy)
summary(fit)
model <- ' # direct effect
Y ~ c*X
# mediator
M ~ a*X
Y ~ b*M
# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)
'
fit <- sem(model, data = PoliticalDemocracy)
summary(fit)
P.D. I think one option in the Bayesian context would be the R2OpenBUGS package:
However, it would be nice to know whether I could use blavaan for the same analysis.
Thanks in advance and the best regards,