# Pp\_check by percentile as test statistic?

**URL:** <https://discourse.mc-stan.org/t/pp-check-by-percentile-as-test-statistic/9257>\
**Category:** brms\
**Tags:** bayesplot\
**Created:** [June 13, 2019, 10:19pm UTC](https://discourse.mc-stan.org/t/pp-check-by-percentile-as-test-statistic/9257 "2019-06-13T22:19:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilan\_Strauss](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ilan_strauss/32/4928_2.png) [@Ilan\_Strauss](https://discourse.mc-stan.org/u/Ilan_Strauss)\
**Post date:** [June 13, 2019, 10:19pm UTC](https://discourse.mc-stan.org/t/pp-check-by-percentile-as-test-statistic/9257/1 "2019-06-13T22:19:05Z")

</div>

Hi,

How would we do pp\_check by percentiles for _brms()_ ? i.e. for specified test statistics other than min, max, mean, median?

Thank you!

---

<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:** [June 14, 2019, 2:29am UTC](https://discourse.mc-stan.org/t/pp-check-by-percentile-as-test-statistic/9257/2 "2019-06-14T02:29:18Z")

</div>

I think you should be able to pass the `stat` argument via `...` to `bayesplot::ppc_stat()`, which is the function called behind the scenes for the plots of statistics. `stat` can be any function that takes a vector input and returns a scalar (statistic). For example, `stat = function(x) quantile(x, probs=0.9)`
