# Posterior Predictive Check

**URL:** <https://discourse.mc-stan.org/t/posterior-predictive-check/29571>\
**Category:** Modeling\
**Tags:** fitting-issues\
**Created:** [November 23, 2022, 2:06pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-check/29571 "2022-11-23T14:06:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laxmi\_Pd\_Sapkota](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/laxmi_pd_sapkota/32/11814_2.png) [@Laxmi\_Pd\_Sapkota](https://discourse.mc-stan.org/u/Laxmi_Pd_Sapkota)\
**Post date:** [November 23, 2022, 2:06pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-check/29571/1 "2022-11-23T14:06:41Z")

</div>

Hello everyone, Is this interval plot correct? I have conducted the PPC using Rstan of a probability distribution and the interval plot is generated using `bayesplot` package which is like this ,

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/b/b3911841a8a049fba540ccc7f8cd8d940882674f.png)

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [November 23, 2022, 7:45pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-check/29571/2 "2022-11-23T19:45:06Z")

</div>

What do you mean by correct? I can interpret that your model is predicting with constant mean and scale. Can you tell more about your data and model?

---

<div class="post-metadata">

**Author:** ![Laxmi\_Pd\_Sapkota](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/laxmi_pd_sapkota/32/11814_2.png) [@Laxmi\_Pd\_Sapkota](https://discourse.mc-stan.org/u/Laxmi_Pd_Sapkota)\
**Post date:** [November 24, 2022, 4:00pm UTC](https://discourse.mc-stan.org/t/posterior-predictive-check/29571/3 "2022-11-24T16:00:22Z")

</div>

Thank you, may I report this plot in my research article and  
How to predict each data point and construct a credible interval for each data point rather than the average of the data. My stan script is given below

```nohighlight
real expexp_power_rng(real alpha, real lambda, real theta){
    return ((1.0/lambda)*log1m(log1m((uniform_rng(0,1))^(1.0/theta))))^(1.0/alpha); \\ Inverse function of CDF

generated quantities{
  vector [N] yrep;
  for(i in 1 : N){
    yrep[i]= expexp_power_rng(alpha, lambda, theta);
  }
y = c(0.8, 0.8, 1.3, 1.5, 1.8, 1.9, 1.9, 2.1, 2.6, 2.7, 2.9,
      3.1, 3.2, 3.3, 3.5, 3.6, 4.0, 4.1, 4.2, 4.2, 4.3, 4.3,
      4.4, 4.4, 4.6, 4.7, 4.7, 4.8, 4.9, 4.9, 5.0, 5.3, 5.5,
      5.7, 5.7, 6.1, 6.2, 6.2, 6.2, 6.3, 6.7, 6.9, 7.1, 7.1,
      7.1, 7.1, 7.4, 7.6, 7.7, 8.0, 8.2, 8.6, 8.6, 8.6, 8.8,
      8.8, 8.9, 8.9, 9.5, 9.6, 9.7, 9.8, 10.7, 10.9, 11.0,
      11.0, 11.1, 11.2, 11.2, 11.5, 11.9, 12.4, 12.5, 12.9,
      13.0, 13.1, 13.3, 13.6, 13.7, 13.9, 14.1, 15.4, 15.4,
      17.3, 17.3, 18.1, 18.2, 18.4, 18.9, 19.0, 19.9, 20.6,
      21.3, 21.4, 21.9, 23.0, 27.0, 31.6, 33.1, 38.5) // data set

```
