I couldn't get the conditional effects and index of moderated mediation

63 views
Skip to first unread message

Aybike Çavdar

unread,
Feb 23, 2024, 2:34:51 AMFeb 23
to lavaan
model15.png
Hi everyone,
I am trying to run the attached model and compare between the two countries. However, when I use the following codes and check the output, there are just regression estimates, intercepts (for MED and DV), variances (just for MED and DV) for both groups and there is nothing but these. Neither conditional effects nor index of modmed. I need help writing correct syntax for the model.
Let me explain my model in more detail. In the model you see in the figure, I expect the moderating variable to weaken the mediation relationship, i.e. I predict that it will have a protective effect on the dependent variable. However, this effect will differ in the two samples due to the cultural background of the countries, and the model will fit the first group better than the second group.

You can also see my question marks in the syntax. Also, I use this syntax directly after importing my dataset with (haven) and activating the (lavaan) library. I don't add (seed) and similar code. All my variables are centered except my dependent variable. I also pre-calculated the interaction terms and added them to my dataset. For clarity, I wrote them as you can see here.

Thanks in advance. 

> Model15 <- '

MED ~ a1*IV

 Dep ~ c1*IV + c2*MOD+ c3* MOD:IV + b1*MED + b2* MOD:MED

#Indirect

a1b1 := a1*b1        #Will I use b2 in here as well?

#direct

c1c3 := c1*c3           #Will the operator be “+”?

#Total

total := a1b1 + c1c3

 

#Index of moderated mediation

index.mod.med := b1*c3            #Should I add “b2” as well?

 

#MOD~ MOD.mean*1

MOD~ MOD.mean* 1

 

#MOD~~ MOD.var* MOD

MOD~~MOD.var* MOD

 

#Are the following codes about indirect, direct and total effects conditional on moderator correct?

# Indirect effects conditional on moderator

indirect.SDbelow := (a1 + b2*( MOD.mean-sqrt(MOD.var))) * b1

indirect.SDabove := (a1 + b2*( MOD.mean+sqrt(MOD.var))) * b1

 

# Direct effects conditional on moderator

direct.SDbelow :=  c1 + c3*( MOD.mean-sqrt(MOD.var))

direct.SDabove :=  c1 + c3*( MOD.mean+sqrt(MOD.var))

 

# Total effects conditional on moderator

total.SDbelow :=  direct.SDbelow + indirect.SDbelow

total.SDabove :=  direct.SDabove + indirect.SDabove

 

# Proportion mediated conditional on moderator

prop.mediated.SDbelow =~  indirect.SDbelow / total.SDbelow

prop.mediated.SDabove =~  indirect.SDabove / total.SDabove

 

## Ensure country variable is character

IntOrnek$country <- as.character(IntOrnek$country)  # Add this line'

 

# Fit the multigroup model

Model15Sem <- sem(Model15, data = IntOrnek, estimator = "MLR", missing = "ML", group = "country")

 

Model15Sem.constrained <- sem(Model15, data =  IntOrnek, estimator = "MLR", missing = "ML", group = "country", group.equal = c("regressions"))

 

summary(Model15Sem, modindices = TRUE, fit.measures = TRUE, standardized = TRUE)

Reply all
Reply to author
Forward
0 new messages