# Path analysis - model writing check (Rstudio- lavaan package)

Below you will find the Figure of the path model that I wrote in Rstudio. model2 <- '

• #direct effect
• INT ~ e*PN
• PN ~ d*AR
• AR ~ c*AC
• AC ~ b*PB
• PB ~ a*BV
• #indirect effect
• ed := e * d
• edc := e * d * c
• edcb := e * d * c * b
• edcba := e * d * c * b * a
• totalind:= ed + edc + edcb + edcba
• total:= e + ed + edc + edcb + edcba
• '

fit_model <-lavaan::sem(model2, data = Data, estimator='MLR') summary(fit_model, fit.measures=TRUE, ci=TRUE

I am wondering if you agree with how I wrote the model, particularly, the totalind that corresponds to the sum of all indirect effects and the total.

I am wondering if you agree with how I wrote the model, particularly, the totalind that corresponds to the sum of all indirect effects and the total.
No, total (indirect) effects would be the sum of all (in)direct effects from one predictor (e.g., BV) to one outcome (e.g., INT). In your model, there is only 1 path from BV to INT, and it is the indirect effect you labeled edcba. There is no other path, so there is no "total" to calculate. If you included a direct effect in your model syntax (INT ~ dir*BV), then the total effect would be total := dir + edcba). Likewise, if you included other effects of BV on other mediators, you could have other indirect paths. For example, PN ~ f*BV would create another indirect effect (ef := e*f), so you could calculate a total indirect effect (totalind := edcba + ef) and total effect (total := dir + edcba + ef). It gets more complicated as you add more effects, but that is the basic idea.