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 = Data)
summary(model, fit.measures=TRUE, rsquare=TRUE, standardized=TRUE)
model_2 <- ' # direct effect
Y ~ c*X + Sex + SES
# mediator
M ~ a*X + Sex + SES
Y ~ b*M
# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)
'
fit <- sem(model_2, data = Data)
summary(model_2, fit.measures=TRUE, rsquare=TRUE, standardized=TRUE)
Am I correct to specify the model as above?
sem(..., ordered = c("M","Y"), ...)
Do you know if the decomposition into direct and indirect would be accurate given that either the mediator and or the outcome is binary?
I have 5 mediators (PE, EE, SI, HM and FC), 1 outcome variable (BI), three predictors (CarUse, PublicTransportUse, TechAcceptance)
mod.PE <-' PE =~ V2_PE1 + V2_PE2 + V2_PE3
EE =~ V2_EE1 + V2_EE2 + V2_EE3
SI =~ V2_SI1 + V2_SI2 + V2_SI3
BI =~ V2_BI1 + V2_BI2 + V2_BI3
HM =~ V2_HM1 + V2_HM2 + V2_HM3
FC =~ V2_FC1 + V2_FC2 + V2_FC3
BI ~ b1 * PE + b2 * EE + b3 * SI + b4 * FC + b5 * HM + c1 * CarUse + c2 * PublicTransportUse + c3 * TechAcceptance PE ~ a1 * CarUse + a1 * PublicTransportUse + a1 * TechAcceptance EE ~ a2 * CarUse + a2 * PublicTransportUse + a2 * TechAcceptance SI ~ a3 * CarUse + a3 * PublicTransportUse + a3 * TechAcceptance FC ~ a4 * CarUse + a4 * PublicTransportUse + a4 * TechAcceptance HM ~ a5 * CarUse + a5 * PublicTransportUse + a5 * TechAcceptance
indirect1 := a1 * b1
indirect2 := a2 * b2
indirect3 := a3 * b3
indirect4 := a4 * b4
indirect5 := a5 * b5
total := CarUse + (a1 * b1) + (a2 * b2) + (a3 * b3) + (a4 * b4) + (a5 * b5) + PublicTransportUse + (a1 * b1) + (a2 * b2) + (a3 * b3) + (a4 * b4) + (a5 * b5) + TechAcceptance + (a1 * b1) + (a2 * b2) + (a3 * b3) + (a4 * b4) + (a5 * b5)
PE ~~ EE
PE ~~ SI
PE ~~ FC
PE ~~ HM
EE ~~ SI
EE ~~ FC
EE ~~ HM
SI ~~ FC
SI ~~ HM
FC ~~ HM’
fit.PE <- sem(model = mod.PE, data = Datensatz_neu.sav)
summary(fit)
Many thanks!!!!
I do not get any output when running it so apparently it does not work.
BI ~ b1 * PE + b2 * EE + b3 * SI + b4 * FC + b5 * HM + c1 * CarUse + c2 * PublicTransportUse + c3 * TechAcceptance PE ~ a1 * CarUse + a1 * PublicTransportUse + a1 * TechAcceptance EE ~ a2 * CarUse + a2 * PublicTransportUse + a2 * TechAcceptance SI ~ a3 * CarUse + a3 * PublicTransportUse + a3 * TechAcceptance FC ~ a4 * CarUse + a4 * PublicTransportUse + a4 * TechAcceptance HM ~ a5 * CarUse + a5 * PublicTransportUse + a5 * TechAcceptance
I don't completely follow your explanation
BI ~ b1 * PE + b2 * EE + b3 * SI + b4 * FC + b5 * HM + c1 * CarUse + c2 * PublicTransportUse + c3 * TechAcceptancePE ~ a1 * CarUse + a1 * PublicTransportUse + a1 * TechAcceptanceEE ~ a2 * CarUse + a2 * PublicTransportUse + a2 * TechAcceptanceSI ~ a3 * CarUse + a3 * PublicTransportUse + a3 * TechAcceptanceFC ~ a4 * CarUse + a4 * PublicTransportUse + a4 * TechAcceptanceHM ~ a5 * CarUse + a5 * PublicTransportUse + a5 * TechAcceptance