Search code examples
statisticsr-lavaan

SEM Model Syntax Given Path Diagram


I am trying to recreate an analysis of mediation using SEM. I have the following path diagram enter image description here

It's clear to me that "FM" is related to "EI" through RMR. The indirect effect is 0.25 (0.40 * 0.63) with a "direct effect" of -0.41. However, I am unable to confidently write the model syntax for lavaan . How would one write this syntax?

Additionally, what do the double arrows represent (for example, 0.11 between FM and FFM) -- is this the "covariance". Does this impact the paths going from FM to FFM? Lastly, is this mediation model achievable just using an OLS framework? What advantage did SEM provide?


Solution

  • I would first recommend reading the method section of the paper that diagram came from because it will give you additional clues about their model that can't always be seen from a path diagram. However, I think the model would look something like this (but check that you get the same coefficient estimates as in the diagram):

    model <- '
        EI ~ RMR + FM
        RMR ~ FM + FFM + Age + Sex
    
        FM ~~ FFM
        FM ~~ Age
        FM ~~ Sex
        FFM ~~ Age
        FFM ~~ Sex
        Age ~~ Sex
    '
    

    The double arrows (indicated by ~~ in the model) represent the covariance of the residuals. You would include these if you think two variables are related beyond what you were able to measure. Whether you include those residual covariances or not will affect the estimated coefficients because in one case you are saying the variables are unrelated beyond the measured variables, and in the other case you are expecting there to be some association.

    I dont think this is achievable with regular OLS, although I'm not 100% sure. SEM has the benefit of modelling latent variables (which you dont have), but it also allows for simultaneous estimation of multiple dependent variables (which you do have). Additionally, notice that the model is actually constrained because it is not modelling a path between Age and EI, for example, and SEM allows for arbitrary constraints that aren't easy to achieve with OLS