stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
388 stars 133 forks source link

Request: flexible residual covariance structures #532

Open wlandau opened 3 years ago

wlandau commented 3 years ago

Summary:

It would be great if rstanarm supported more advanced structures for the covariance matrix of the residuals.

Description:

I use Bayesian longitudinal models for clinical trial data analysis, usually MMRM and GLIMMIX. The norm in the open source world seems to be to express longitudinality through subject-specific random effects, and rstanarm is already capable of this. But for better or worse, all my stats colleagues are opposed to this approach. They believe this is not a true longitudinal model and that random effects would incur overparameterization issues anyway. This stance seems to be widespread in pharma. So I am required to avoid random effects and make the residual covariance block-diagonal, where the (common) block is fully parameterized (i.e. unstructured). Would you be open to allowing these covariances in stan_glm() and stan_glmer()? Currently, rstanarm is limited to $\sigma^2 I$, so I have to use MCMCglmm, which does not have as convenient an interface.

Reproducible Steps:

N/A

RStanARM Version:

2.12.1

R Version:

4.0.2

Operating System:

Mac OS 10

lauken13 commented 3 years ago

Hi,

Can't speak for the rstanarm team as to whether they want to allow these particular covariances, but have you seen brms? I use it a lot for models that require a bit more flexibility than what rstanarm does (love rstanarm for teaching and simpler models though!). In brms the models need to be compiled, which can be a hassle, but it now supports cmdstanr as a back end, so it's much easier than it has been previously! :)

wlandau commented 3 years ago

Thanks, @lauken13. I did look at brms, but https://www.jstatsoft.org/article/view/v080i01 seems to describe the same limitation. But I did find threads https://github.com/paul-buerkner/brms/issues/403 and https://discourse.mc-stan.org/t/unstructured-error-covariance-matrix-in-a-multilevel-growth-model/21792.

wlandau commented 3 years ago

I think my previous comment was too quick to dismiss brms, sorry about that. The capability was not officially documented last time I checked, but it looks like https://discourse.mc-stan.org/t/unstructured-error-covariance-matrix-in-a-multilevel-growth-model/21792/4 made progress on a workaround. I think it may work in my case because I do not need group-level effects.

lauken13 commented 3 years ago

Yeah every time I look, Paul has implemented something else super nifty. Glad it helps! You can also modify the code from brms pretty easily if you only want a small component changed etc.

On Mon, Jun 7, 2021 at 2:41 PM Will Landau @.***> wrote:

I think my previous comment was too quick to dismiss brms, sorry about that. The capability wasn't there last time I checked, but it looks like https://discourse.mc-stan.org/t/unstructured-error-covariance-matrix-in-a-multilevel-growth-model/21792/4 has a bunch of progress on a workaround. I think it may work in my case because I do not need group-level effects.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstanarm/issues/532#issuecomment-855570688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5ZMGBHWUDZ4DEVOZGOVS3TRREYNANCNFSM46GYBJCQ .