Imposing order constraint

I’m trying to understand how can I impose an order constraint on two different RVs. Specifically, I have RVs x_1 and x_2 which are the results of two different GLMs (with shapes ~ (100,)), and I know that “in the real world”, x_1 > x_2. I’ve tried the following ideas:

  1. Use pm.Potential. This caused some convergence issues, and @junpenglao also suggested this is not the best approach here.
  2. Use transform.Order - again, following @junpenglao’s advice. Didn’t understand how to apply it for the case of two different RVs (and not different entries in the same multivariate distribution).
  3. Model x_2 using the GLM, and model delta instead of x_1, such that x_1 = x_2 + delta. This makes sure x_1 > x_2, but then I’m not sure how to interpret the distributions over the coefficients of the GLMs.

Is there any recommended approach? Or something different altogether?

2 Likes

I remember the last paragraph of https://colindcarroll.com/2018/07/20/why-im-excited-about-pymc3-v3.5.0/ was quite helpful

I would try with this. For interpretation of the coefficient you can always add the delta to x_1 and avoid interpreting the delta directly.

Thanks! Introducing the “delta probability” variable indeed gives me what I want, at the cost of the lesser interpretability (since now I don’t have a “explicit” GLM for x_1) and longer sampling times (perhaps the pm.math.minimum(x_2+delta,1) is giving the sampler a hard time?).