I would, because the Stan manual says matrices are more efficient than arrays, in particular if you respect the column major indexing. But I haven’t tested it.
Okay… Didn’t know that. Thanks! When I have a little bit of time, I’ll try it!
Dear @Rick_RS95
Thank you for working on this important aspect of improving the speed of fitting brms models. I believe the ragged-array approach for unbalanced data is perhaps the best option across different scenarios.
Could you please provide an example of simulating three-level data in which level-1 observations are nested within individuals at level 2, who are in turn nested within studies at level 3. It would be very useful to show how to fit a random intercept and slope model to such data using brms, and then modify the code to use a ragged-array approach.
In particular, it would be helpful to show:
-
how to create the array structure in R,
-
how to pass that structure to Stan using brms stanvars,
-
and how to adapt the model code accordingly.
This would be very helpful.
Thank you