openpharma / brms.mmrm

R package to run Bayesian MMRMs using {brms}
https://openpharma.github.io/brms.mmrm/
Other
18 stars 2 forks source link

Multiple covariance structures #88

Closed wlandau closed 7 months ago

wlandau commented 7 months ago

Toeplitz, AR(1), etc. Should be straightforward to just supply the right brms functions to the formula in brm_formula().

wlandau commented 7 months ago

From http://paul-buerkner.github.io/brms/reference/autocor-terms.html, it looks like we could add arma, ar, ma and cosy. The other choices sar, car, and fcor look designed for spatial data (thus out of scope).

We could also omit sigma ~ 0 + time in the second part of the formula, which I think will make the covariance structure homogeneous.

I think these options should cover most of the major MMRM use cases, certainly everything currently available in brms that applies to us. Please let me know if you disagree. The only other thing we could ask for is Toeplitz, which I don't see in the brms docs.

wlandau commented 7 months ago

In https://github.com/paul-buerkner/brms/issues/403 it looks like Toeplitz has already been requested.

wlandau commented 7 months ago

We could also omit sigma ~ 0 + time in the second part of the formula, which I think will make the covariance structure homogeneous.

Indeed this makes the variances homogeneous, but it also changes the parameterization. In the heterogeneous case, we have parameters b_sigma on the log scale. But in the homogeneous case, we have a parameter sigma on the linear scale, and its prior is bounded below at 0. Although the reparameterized Stan code looks simpler and possibly faster, I feel this inconsistency in the parameterization could be confusing for users. I am in favor of instead including sigma ~ 1 so the model is consistent between the homogeneous and heterogeneous cases. Again, please let me know if you disagree.