Hello,
I am new to brms and trying to perform a parallel mediation test for trial-wise within-person experimental data. I’d like to get some help with the mediation pathways interpretation.
Briefly, I’d like to test the independence of two serial pathways:
Indirect pathway 1: valmn→AMY→ FPl →Temp
Indirect pathway 2: valmn→AMY→PRC→Temp
Below are my scripts:
model <- brm(
# M1: AMY ~ valmn
bf(AMY ~ valmn + aromn + ActionGoal + order +(valmn | sub)) +
# M2: FPl ~ AMY + valmn
bf(FPl ~ AMY + valmn + aromn + ActionGoal + order + (valmn | sub)) +
# M3: RPC ~ AMY + valmn
bf(PRC ~ AMY + valmn + aromn + ActionGoal + order_final + (valmn | sub)) +
# Final outcome: Temp ~ FPl + RPC + valmn
bf(Temp ~ FPl + PRC + AMY + valmn + aromn + order_final + (valmn | sub)) +
set_rescor(FALSE),
data = tmpdf,
chains = 4,
cores = 4,
iter = 4000,
control = list(max_treedepth = 15, adapt_delta = 0.95),
seed = 123
)
This is the way that I got the results of the above model:
post <- as_draws_df(model)
post$indirect1 <- post$b_AMY_valmn * post$b_FPl_AMY * post$b_Temp_FPl
post$indirect2 <- post$b_AMY_valmn*post$b_PRC_AMY * post$b_Temp_PRC
post$direct <- post$b_Temp_valmn
post$total <- post$indirect1 + post$indirect2 + post$direct
post$mediated <- (post$indirect1 + post$indirect2) / post$total
# Summary
summarize_draws(post[, c("indirect1", "indirect2", "direct", "total", "mediated")])
First of all, are the above ways to use brms proper to test the parallel mediations of pathway1 and pathway2? The specific question is that, instead of the main factors, I have a bunch of control factors (e.g., ActionGoal, order) and random intercept and slope in the model. Do I allow to control them in every node of the pathways? If not, what’s the proper way to conduct parallel mediation with brms with all the control and random factors?
To test the independent parallel mediation via both indirect pathway 1 and 2, should I interpret the posteriors for indirect1 and indirect2 or the mediated posterior?
I also tried to test the significance of each indirect pathway independently and compared their model fits with the parallel model. For example:
##for valmn->AMY->FPl->Temp
model_p1 <- brm(
# M1: AMY ~ valmn
bf(AMY ~ valmn + aromn + ActionGoal + order +(valmn | sub)) +
# M2: FPl ~ AMY + valmn
bf(FPl ~ AMY + valmn + aromn + ActionGoal + order + (valmn | sub)) +
# Final outcome: Temp ~ FPl + RPC + valmn
bf(Temp ~ FPl + AMY + valmn + aromn + order_final + (valmn | sub)) +
set_rescor(FALSE),
data = tmpdf,
chains = 4,
cores = 4,
iter = 4000,
control = list(max_treedepth = 15, adapt_delta = 0.95),
seed = 123
)
loo_full_parallel <- loo(model, resp = "Temp")
loo_p1 <- loo(model_p1, resp = "Temp")
loo::loo_compare(loo_full_parallel, loo_p1)
The model comparison showed improvement with the parallel pathway, but weak (the elpd_diff is not bigger than se_diff). Does this model comparison test for the independence of the pathway1 and pathway2 mediation effect? If not, whether should I use model comparison to test the independence of the pathway mediation effect?
Thanks in advance!