Monotonic categorical effect?

Hi all,

Is there a way to do something like this in pymc3?
https://paul-buerkner.github.io/brms/articles/brms_monotonic.html

Briefly, I want to model the effect of a monotonic effect of a categorical(ordinal?) variable.
As in the link above, Y is life-satisfaction and X is income bracket, for example
‘below 20k’, ‘between 20k and 40k’, ‘between 40k and 100k’ and ‘above 100k’.
I want to impose the constraint that on average a higher income bracket leads to a higher life-satisfaction.

Thank you!

PS: I couldn’t figure out how to include equations in my post :frowning:

I have an exact port of this: https://github.com/junpenglao/Planet_Sakaar_Data_Science/blob/master/Ports/brms_monotonic_compare.ipynb

2 Likes