# Order constraints on model parameters

Hi,

I have a question about the order constraints on model parameters. Suppose I have

parameters{
ordered mu;
}

Then by default I would have mu < mu < mu, thus I was wondering if there exists a built-in command that could allow me to have mu > mu > mu?

Thanks!

``````parameters{
ordered mu_raw;
}
transformed parameters{
vector  mu = -mu_raw;
}
``````

or

``````parameters{
ordered mu_raw;
}
transformed parameters{
vector  mu;
for(i in 0:2)
mu[i] = mu_raw[3-i]
}
``````

Thank you! So what if I wish to define a matrix of parameters, with each row ordered, say

matrix[3,3] mu;

with mu[1,1] > mu[1,2] > mu[1,3];
mu[2,1] > mu[2,2] > mu[2,3];
mu[3,1] > mu[3,2] > mu[3,3];

how could I set up such constraints?

Thanks!

`ordered mu`

And if you need to, you can copy the array into a matrix:

``````parameters {
ordered mu_arr;
...
transformed parameters {
matrix[3, 3] mu;
for (k in 1:3) mu[k] = mu_arr';
...
``````

What about a 2-dim array real b[M, N] that I want ordered by the first ‘row’ b[1,]? Is it easier/different with one of the other 2 dimensional container types?

Badly phrased question - I want to the columns to be ordered by the values in the first row, i.e. impose a permutation pi such that b[1,pi(j)] is increasing in j.