I would like to compare models for:
- The direct effect of X on Y.
- The effect of X on Y, mediated by M.
- The effect of X on Y, mediated by M, where this mediation is fully moderated by another variable Z.
I would fit these three models using the following syntax:
brm(Y ~ X)
brm(bf(Y ~ X + M) + bf(M ~ X) + set_rescor(FALSE))
brm(bf(Y ~ X*Z + M*Z) + bf(M ~ X*Z) + set_rescor(FALSE))
.
However, when comparing these models with compare_ic()
, brms complains (rightly) that:
Warning message: Model comparisons are likely invalid as the response values of at least two models do not match.
This is because Model 1 does not include M.
To remedy this problem, should I simply refit Model 1 as brm(bf(Y ~ X) + bf(M ~ 1) + set_rescor(FALSE)
? These two model parts will be estimated separately from one another.
Thanks in advance for your help (and for the amazing package)!