plotting the mediation model

Posted on
No user picture. Tooglad Joined: 05/14/2024
Dear Prof Cheung,

I am currently working on a research project that involves implementing a two-step structural equation model. My question is whether anxiety mediates the relationship between mindfulness and meaning. However, the code for plotting the mediation model is not displaying the mediator variable in the right box. Below is the code I tried:

# Proposed model
model <- "Meaning ~ c*Anxiety + b*Mindfulness
Mindfulness ~ a*Anxiety
Anxiety ~~ 1*Anxiety"
plot(model, color="yellow")

RAM1 <- lavaan2RAM(model, obs.variables = varlist)
RAM1

stage2 <- tssem2(stage1, RAM=RAM1, intervals.type = "LB",
mx.algebras = list(Indirect=mxAlgebra(a*b, name="Indirect"),
Direct=mxAlgebra(c, name="Direct")))
summary(stage2)

plot(stage2, color="yellow")

My understanding is that the trianglular plot shows the mediating variable at the top (between the IV and DV), but this is not the case when I implement the above code. Instead, the plot shows the IV at the top, and mediator on the right, and the DV on the left. Ideally, I want the IV (Anxiety) on the left, the mediator (mindfulness) on the top, and the DV (meaning) on the right. Is there anything I’m not doing right? I have attached the plots from one of your papers (Schutte, Keng, & Cheung, 2021), which show the mediator ‘emotional intelligence’ at the top. However, this doesn’t appear to be the case when I tried to create a similar plot using the same code (see my plot attached). Any assistance would be greatly appreciated.

Thank you,

Tooglad

Replied on Sat, 09/21/2024 - 02:07
Picture of user. Mike Cheung Joined: 10/08/2009

Hi Tooglad,

Since I cannot find the attached figures, I can only guess that both figures are correct but with different arrangements.

haveThere is more than one way to arrange the plots. I don't know if the semPlot package can fix the arrangement. 

Best,
Mike

 

Replied on Mon, 09/23/2024 - 22:50
Picture of user. Mike Cheung Joined: 10/08/2009

Hi Tooglad,

Both of them are correct. The figure reported in Schutte, Keng, & Cheung (2021) was generated from Graphviz using the dot language.

If you do not like the figures generated by semPlot, please feel free to use other programs to do it.

Mike