How to perform posterior predictive checks

Dear Stan,
I’d like to repelicate the figure 6.12 in the book, bayesian data analysis, written by gelman et al. Are there RStan codes for the figure?
Thanks in advance.

The stan user guide page should give you everything you need, given that you have the data itself to replicate…

https://mc-stan.org/docs/stan-users-guide/posterior-predictive-checks.html