One thing to note:
if you have a simulator that can simulate new data for you exactly according to your model, you can check easily if the Stan model recovers the parameters from simulated data. If not, your simulator and model do not match and at least one of the is wrong. This should help you debug your model by yourself.

Note that mu is on the log scale, so you should be comparing y to exp(mu[1]). With that it actually seems that the estimates for rows 8 - 16 are roughly OK, but some of the initial rows seems grossly overestimated e.g. exp(9.17) = 9604

In my previous post I was not speaking about using generated quantities for posterior predictive checks (although that is often useful as well), I meant writing a simulator to create fake/simulated data in R/Python/… where you now the values of alpha, beta, pi etc. (because you simulated them from the priors).

In any case, this topic is taking more time than I am willing to invest in it and I will therefore not interact here any more. It seems to me that your aims are currently higher than your skills with Stan - which is good and you should keep trying! - but it also means that you would benefit from a more intensive mentoring than I am able to sustainably provide you for free on this forum. You may consider finding an official mentor or read up on statistics/model development in general and experiment with simpler problems to improve your grasp on the foundations of Bayesian inference. My feeling (though possibly wrong) is that those foundations might be necessary for your current problem and it would increase your independence in problem solving in general. I wish you best of luck with further learning and hope my suggestions so far have helped you learn and grow.

One more note: my last post had a narrow scope - it spoke about this particular topic and about myself - I do not and cannot speak on behalf of other memebers of the community who might feel otherwise. And from my perspective, you are certainly welcome to ask further questions on this forum as you move forward and discover specific obstacles.

Just to add to what martin said. I think he’s right that this topic has run it’s course. I think it would be good if you could familiarize yourself a bit more with Stan and the language that people use to describe different steps in the analysis process before doing your analysis. I tried to look for an example of a poisson case study and there are some floating around on the internet but I could not directly find one that does everything.

Ideally you want to be able to

Simulate data from a simple poisson distribution (outside of Stan probably)

Use Stan to estimate the parameter in your simulated data and be able to diagnose bugs and warnings.

Generate posterior predictions (You need the _rng functions in Stan to do this).

I hope this does not come across as too patronizing. I am happy to answer future separate questions if they pop up on discourse. It’s just that this debugging step by step on discourse cannot be the most useful way of learning Stan.