I am interested in an ordered simplex - I have a mixture model, and am getting switching of parameters for different threads, but believe an ordered simplex would solve that issue. Is it possible to enforce this ordering? Is enforcing an ordering on a simplex a bad idea on a mixture model?

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.

Thank you - this is a creative approach. I will give it a try to see if it leads to disaster ;)

Why wouldnâ€™t this work? Itâ€™s identified through the prior.

Of course, the prior will matter here for fitting.

A simpler alternative

```
parameters {
positive_ordered[K] pi_raw;
...
transformed parameters {
ordered[K] pi = softmax(pi_raw);
```

wonâ€™t work because the `pi_raw`

parameters wonâ€™t be identified. And you canâ€™t just add a zero value to identify if you want to preserve orderedness. You canâ€™t just put a prior on `pi`

here without including the log Jacobian of the softmax transform, either.

Something about when you have so much data that the posterior distribution of `pi`

has very little variance, then NUTS has to take many very small steps to navigate through the values of `lambda`

that is consistent with both that value of `pi`

and the gamma prior on `lambda`

.