# Ordered parameters and their prior distributions

**URL:** <https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054>\
**Category:** Modeling\
**Created:** [October 13, 2023, 2:32pm UTC](https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054 "2023-10-13T14:32:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjacketti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mjacketti](https://discourse.mc-stan.org/u/mjacketti)\
**Post date:** [October 13, 2023, 2:32pm UTC](https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054/1 "2023-10-13T14:32:46Z")

</div>

I have two parameters in my Stan model `mo` and `m1` and we know that m1 \> m0, so I placed an ordering on them. I have then identified 2 prior distributions for the parameters. However, because they are ordered, do I have to define the relationship between `m0` and `m1` using a bivariate distribution?

```stan
parameters {
      real<lower=0> m0;
      real<lower=m0> m1;
}

model {
   
   // Priors
      m0 ~ student_t(N_obs0 - 1, lmean0, sqrt(s0sq/(N_obs0 - 1)));
      m1 ~ student_t(N_obs1 - 1, lmean1, sqrt(s1sq/(N_obs1 - 1)));

```

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [October 15, 2023, 1:15pm UTC](https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054/2 "2023-10-15T13:15:10Z")

</div>

Stan has the [`ordered`](https://mc-stan.org/docs/reference-manual/ordered-vector.html) parameter type - [1.8 Ordered logistic and probit regression | Stan User’s Guide](https://mc-stan.org/docs/stan-users-guide/ordered-logistic.html#ordered-logistic.section)

---

<div class="post-metadata">

**Author:** ![mjacketti](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@mjacketti](https://discourse.mc-stan.org/u/mjacketti)\
**Post date:** [October 16, 2023, 1:31pm UTC](https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054/3 "2023-10-16T13:31:15Z")

</div>

Thanks! But how would I use the `ordered_logistic()` while keeping the `student_t()` distributions for m0 and m1?

---

<div class="post-metadata">

**Author:** ![jsocolar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsocolar/32/2486_2.png) [@jsocolar](https://discourse.mc-stan.org/u/jsocolar)\
**Post date:** [October 16, 2023, 2:19pm UTC](https://discourse.mc-stan.org/t/ordered-parameters-and-their-prior-distributions/33054/4 "2023-10-16T14:19:46Z")

</div>

If you specify a prior that does not respect the ordering constraint (or any constraint in Stan), then functionally what you get is a prior that is truncated by the constraint. So if you apply student t priors, you will get a joint prior corresponding to a bivariate t distribution truncated at the `m0 = m1` line. The margins of this thing will not be student t. If you want student t margins, then you would need to work out for yourself the log probability density for some bivariate prior that has student t margins and respects the ordering constraint.
