Hi

I am working on a multivariate ordered logistic model. The issue that I have is that the variables have different number of categories.

For simpler cases I can do something like this, with 3 variables and each one having 4 cutpoints

```
ordered[4] kappa[3];
```

But for this case I need a ordered vector type where each variable is allowed to have different number of cutpoints.

The way that I can do it right now is to define a different parameter for each variable, but this would make my code much longer, and muddier, like this

```
ordered[4] kappa1;
ordered[3] kappa2;
```

Anybody knows a way to set a ordered vector like this?

Thank you

Unfortunately I don’t think there’s an easy way.

As a fallback you could implement the ordering transforms manually if you needed these constraints to be programmatic. The documentation for that constraint is here: https://mc-stan.org/docs/2_18/reference-manual/ordered-vector.html and the code is here: https://github.com/stan-dev/math/blob/develop/stan/math/prim/mat/fun/ordered_constrain.hpp

You can translate that into Stan manually. It’ll be messy, but work. I guess whether or not this is good is a function of how many different constraints you need and how much you need to modify them.

This is a similar question/answer: How to specify variable parameter constraints based on other model parameters

Hope that helps!

Thank you for the quick reply.

I think will be easier to write the model for each item separately. If either way would be messy, I can safe myself time this way.

It does help, as I wont be chasing over it

1 Like