# PPC for ordered\_logistic?

**URL:** <https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881>\
**Category:** General\
**Created:** [May 20, 2019, 4:09pm UTC](https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881 "2019-05-20T16:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike-lawrence](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mike-lawrence/32/59_2.png) [@mike-lawrence](https://discourse.mc-stan.org/u/mike-lawrence)\
**Post date:** [May 20, 2019, 4:09pm UTC](https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881/1 "2019-05-20T16:09:51Z")

</div>

I have some data I’m modeling as `y ~ ordered_logistic(...)`, and have `y_rep ~ ordered_logistic_rng(...)` in my generated quantities section so I can run posterior predictive checks, but I’m unsure as to what quantities to compute from y & y\_rep that would make for sensible PPCs. Any suggestions?

---

<div class="post-metadata">

**Author:** ![martinmodrak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/martinmodrak/32/133_2.png) [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Post date:** [May 23, 2019, 10:30am UTC](https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881/2 "2019-05-23T10:30:12Z")

</div>

I’ve had some success with P(Y \> c) for a sensible c thad divides the ordinal response roughly in the middle for most cases.

Here is a custom plot I made and found useful, it combines some elements of PPCheck with exploring the implications of the model. For each data point I make predictions by varying a single variable across the range of its values:

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

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

The veritcal bars show posterior credible intervals. Each line connects all predictions from the same sample and the same data point (a random subset shown), green circles are the observed data (size indicates number of cases). Line blue when the probability increases and red when decreases.

---

<div class="post-metadata">

**Author:** ![jonah](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonah/32/200_2.png) [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Post date:** [May 23, 2019, 5:16pm UTC](https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881/3 "2019-05-23T17:16:25Z")

</div>

Would `ppc_bars()` or `ppc_bars_grouped()` in **bayesplot** be helpful?

> **[PPCs for discrete outcomes — PPC-discrete](https://mc-stan.org/bayesplot/reference/PPC-discrete.html)**
>
> Many of the PPC functions in bayesplot can
> be used with discrete data. The small subset of these functions that can
> only be used if y and yrep are discrete are documented
> on this page. Currently these include rootograms for count outcomes and...

---

<div class="post-metadata">

**Author:** ![mike-lawrence](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mike-lawrence/32/59_2.png) [@mike-lawrence](https://discourse.mc-stan.org/u/mike-lawrence)\
**Post date:** [May 23, 2019, 5:33pm UTC](https://discourse.mc-stan.org/t/ppc-for-ordered-logistic/8881/4 "2019-05-23T17:33:17Z")

</div>

I think I created something functionally similar showing violin plots of the counts of responses in each 4 responses X 23 questions in my data, with dots showing the observed data counts:

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

I’m a little concerned that the dots fall in the 50% intervals in 90 of the 92 distributions, which as I understand it usually means the model is over-fitting somehow. But maybe since these counts are a transform of both y & y\_rep, that’s ok?
