Is there any example of a multi-level model using reduce_sum, slicing over the group-level parameter vector? I’d believe slicing over the data is rather similar for multi-level models and the minimal example. (Please confirm?) Much appreciated. Thank you very much.

Thank you. When you have time, are you able to provide a bit more commentary on what is going on? I am not fully able to follow it. I will also try again when my mind is fresher. Thanks.

I have a varying intercept by group “g”. It makes thus sense to do the partial sums over groups formed by “g”. To do that I am sorting the data-set first by group membership. The code exemplifies everything.