# Ordered Simplex

**URL:** <https://discourse.mc-stan.org/t/ordered-simplex/1835>\
**Category:** Modeling\
**Created:** [September 8, 2017, 6:37pm UTC](https://discourse.mc-stan.org/t/ordered-simplex/1835 "2017-09-08T18:37:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [September 8, 2017, 6:49pm UTC](https://discourse.mc-stan.org/t/ordered-simplex/1835/2 "2017-09-08T18:49:32Z")

</div>

It is quite possible to use an ordered simplex if you do

```
data {
  int<lower=1> K;
  vector<lower=0>[K] alpha;
}
parameters {
  positive_ordered[K] lambda;
}
transformed parameters {
  simplex[K] pi = lambda / sum(lambda);
}
model {
  // implies pi ~ dirichlet(alpha)
  target += gamma_lpdf(lambda | alpha, 1);
  // use pi in your likelihood
}

```

Opinions differ as to whether this is a disaster or works perfectly fine.

---

_[View the full topic](https://discourse.mc-stan.org/t/ordered-simplex/1835)._
