Hi there,
I’m currently trying to model a logistic regression where parts of the parameters are known to be ordered, while others are not, i.e. \theta_5 < \theta_6 < \theta_7, and \theta_8 < \theta_9, while for the other parameters, there is no ordering. How can I model this with Stan?
Thanks in advance, Tim
Sorry this took so long to answer. It’s hard to answer in general, but I can show you how to code the specific instance you asked about:
data {
int<lower=9> N;
}
parameters {
ordered[3] theta567;
ordered[2] theta89;
vector[N - 5] theta_other;
}
transformed parameters {
vector[N] theta;
theta[1:4] = theta_other[1:4]
theta[5:7] = theta567;
theta[8:9] = theta89;
theta[9:] = theta_other[5:];
}
It may be easier to consider with scalars as it’s easier to add upper bounds as well as lower bounds.
parameters {
real theta5;
real<lower=theta5> theta6;
real<lower=theta6> theta7;
real theta8;
real<lower=theta8> theta9
vector[N - 5] theta_other;
}
There’s only so far you can go in describing partial orders this way, though.
1 Like