How to properly do out-of-sample prediction for hierarchical model

We discuss this in this blogpost: Out of model predictions with PyMC - PyMC Labs

Check the section # Simulating new groups in hierarchical models, but you might want to read the whole thing to understand exactly what sample_posterior_predictive can and cannot do and how it works.