# SBC with circular parameter

I am trying to use the “donut prior”, as discussed in Divergence /Treedepth issues with unit_vector. I was going to run SBC, but I’m not sure how to calculate a rank statistic with a circular variable. How should I be checking whether an angle sampled from the prior is larger than an angle sampled in one iteration of the chain?

Thanks for the help.

1 Like

Since nobody else answered, I will give it a try: since the ranks should be uniformly distributed, it IMHO should not matter where you “split” the circle. But if possible, I’d like to get a second opinion from @betanalpha or @anon75146577 who’ve thought about this more than I and actually have solid stats foundations :-)

SBC work only for real-valued functions, i.e. functions that map the parameter space to the real numbers, which can be ordered and hence admit well-defined ranks. Any function into the real numbers will give valid ranks and hence a valid SBC.

Typically our ambient space is \mathbb{R}^{N} and we can use the global coordinate functions for SBC. For an N-sphere, however, there aren’t coordinate functions that span the entire space and hence not immediate candidates. Indeed a map from, say, a point on a circle to a circular angle is not real-valued and hence isn’t applicable, which is why one can’t work out self-consistent results.

There are, however, many other valid functions that one could use instead. For example, one could use one of the infinite the maps from a circle into the real interval [0, 2 \pi]. In other words one can use angle coordinate functions (like \theta for a circle or \theta, \phi for a 2-sphere) and treat the discontinuity as infinity.