Using the posterior samples of the \(\theta_i\), the function estimates the ranks of the log odds of harm of the various error profiles. Optimal Bayesian ranking gives estimates of rank for profile \(i\) as
$$\hat{R}_i = \sum_{k=1}^{n}{\hat{P}(\theta_k \leq \theta_i | \boldsymbol{y}, \boldsymbol{N})},$$
where \(\hat{P}(\theta_k \leq \theta_i | \boldsymbol{y}, \boldsymbol{N})\) is the posterior probability that \(\theta_k \leq \theta_i\).
References
Myers, J. A., Venturini, S., Dominici, F. and Morlock, L. (2011), "Random Effects Models for Identifying the Most Harmful Medication Errors in a Large, Voluntary Reporting Database". Technical Report.