Hey I was working on this a while ago, just got my revise and resubmit last week actually. Just to add some of the challenges I ran into as follows.
Typically with these models you want to model the residual correlations on the predictors and the residuals of their lagged effects.
You might try something as follows to get around this…
brm(
bf(y_lag ~ 1) +
bf(x_lag ~ 1) +
bf(y ~ y_lag + x_lag + covariates + (y_lag | id) +
bf(x ~ x_lag + y_lag + covariates + (x_lag | id) +
set_rescor(TRUE),
data = long_data
)
The problem here is that you then model residual correlations of y_lag
by y
, etc. which you might not want. To my knowledge there is no way to choose which residual correlations you want to model in brms
.
I drew this in a state of the art SEM plotter, MS Paint. The red arrow is the bit I think we would struggle with but everything else is quite easily achievable.
Hopefully this is of some interest to you, gotta start paying back the help I get on here !