Hi,
I have a question about the order constraints on model parameters. Suppose I have
parameters{
ordered[3] mu;
}
Then by default I would have mu[1] < mu[2] < mu[3], thus I was wondering if there exists a built-in command that could allow me to have mu[1] > mu[2] > mu[3]?
Thanks!
parameters{
ordered[3] mu_raw;
}
transformed parameters{
vector [3] mu = -mu_raw;
}
or
parameters{
ordered[3] mu_raw;
}
transformed parameters{
vector [3] 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!
And if you need to, you can copy the array into a matrix:
parameters {
ordered[3] mu_arr[3];
...
transformed parameters {
matrix[3, 3] mu;
for (k in 1:3) mu[k] = mu_arr[3]';
...
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.