Predictions with SEM brms

I developed a complex piecewise model using BRMS and I would like to make predictions. Following this discussion, I am stuck with the as.matrix(diag()) step since it only retrieves 8000 predictions from the first 8000 combinations of factors (over 24000 combinations), and discarding 2/3 of the factors of a categorical variable (my posterior draws matrix is 8000*24000).

Instead of using diag(), can I sample 8000 times the posterior matrix systematically across my 24000 combinations (so every 3 columns here) so I am sure that I sample all the combinations and not a biased subset?

Apologies if I misunderstood something.



sorry, but I don’t think we can really help you without seeing the model and the rest of the code you use to prepare data/call the model/extract predictions. The problem seems very specific to details of your setup.