Closed mvuorre closed 3 years ago
Something like this? However, I don't think manually centering the variables will work.
fx1 <- bf(x1 ~ 1)
fy1 <- bf(y1 ~ 1)
fx2 <- bf(wx2 ~ wx1 + wy1)
fy2 <- bf(wy2 ~ wx1 + wy1)
fx3 <- bf(wx3 ~ wx2 + wy2)
fy3 <- bf(wy3 ~ wx2 + wy2)
fit_brms_wide_wc <- brm(
formula =
fx2 + fy2 +
fx3 + fy3 +
fx1 + fy1 +
set_rescor(TRUE),
data = dw,
)
This seems about right, and then we'll need to find a way to correlate x1&y1, x2&y2, x3&y3, optimally such that its not three separate correlations but identical across timepoints. If we just set_rescor(TRUE)
, it is going to correlate all the responses (e.g. y1&wx2), which are already parameters in the model. So if we can e.g. modify the stan code that this outputs, we could do it.
I am not sure why manually centering doesn't work?
Just some quick notes. The brms riclpm needs to include the first timepoint x&y as outcomes, and three residual correlations. These can be added by i. include two more formulas (for 1st wave), ii.
set_rescor(TRUE)
, and maybe by iii. manually set some response correlations to zero in the generated stan code.https://github.com/digital-wellbeing/gametime-longitudinal/blob/41cee75ac6402ebcc89a11bec9f693ac02a6e22e/Models/RI-CLPM/RICLPM-brms-simulation.Rmd#L153