Order statistics in PyMC3

Sorry. My message wasn’t very clear

I know mu_hat isn’t ordered, but the model prefers the correct ordering of mu_hat in that it prefers mu_hat to have the optimal estimate of “yreal”. i.e. the items ranked have values in mu_hat ordered in the same way as yreal once the model is fit.

When we sample mu_hat, and index it (mu[y_argsort]), we use the sampled mu_hat values as the means for the K x J normal prior “latent” from which we sample and apply the Ordered2D transform to obtain the per_rater latent values. If I understand correctly, we then score the ordered sample from “latent” in terms of the probability of such a sample under the prior. We also score the parent mu_hat sample based on the mu_hat prior.

I’m having trouble understanding how mu_hat comes to learn about “yreal” when by definition every sample from “latent” will be ordered. It’s clear to me that somehow the model penalizes the distance from the correct values for mu_hat, but I still don’t quite understand how.

Are there any other models that can be trained in such a way, or further explanation I can find for this type of model?

I had a lot of fun trying to figure this out so far and you have helped me a lot to understand how to handle ranked data in bayesian models