Multi-modal distribution for the random effect (infinite mixture model with a Dirichlet process prior)- Multilevel model

Please also provide the following information in addition to your question:

  • Operating System:
  • brms Version:

I am working on a longitudinal data where I am fitting a multilevel/ Mixed-effect model expressed as follow
y_{it}|\alpha, \beta_i^s, \sigma^2_{\epsilon}, x_{it} \sim N(y_{it}; \alpha x_{it}+ \beta_i^s z_{it}, \sigma^2_{\epsilon})
where \alpha - fixed effect and \beta_i^s is the “random effect” for individual i. Often we assume \beta_i^s to be distributed normally, i.e \beta_i^s \sim N(0, \sigma^2_{\beta^s}).
Here, I want to relax the above assumption ( by modelling \beta_i^s as an infinite mixture of Gaussian. That is,
\beta_i^s \sim \sum_{k=1}^{\infty} \eta_k N( \beta_i^s;\beta_k, Q_k), \sum_{k=1}^{\infty} \eta_k =1 for some weights \eta_k.

Is it possible to specify such kind of model in brms or rstan?

Thank you

In rstan, this is certainly possible. See the Stan manual for how to write mixture models.

In brms, this is not possible but you can perhaps build on brms’ stan code created via make_stancode().