SBC: definition of ranks

In the SBC paper (, the ranks are defined using the binary value of “draw < true” (see page 7 in the corresponding PDF). Apparently, rstan::sbc() uses the definition “draw > true” when defining the ranks for the SBC (see which also includes the comment “# not actually ranks but rather unthinned binary values for draw > true”, so I guess this definition is intended). So my question is: Am I right that the only consequence of the rstan::sbc() definition is a reversed histogram interpretation for a biased posterior sampling algorithm (manifesting in a skewed histogram) compared to the SBC paper: With rstan::sbc(), posterior samples biased to smaller values result in smaller rank statistics (i.e. a right-skewed histogram) and posterior samples biased to larger values result in larger rank statistics (i.e. a left-skewed histogram), whereas this is the opposite direction in the SBC paper?


Your interpretation sounds right, but I would defer to @bgoodri who actually wrote the code (hope he’s not busy and able to answer).

He already answered here.

I think the uniformity of modified rank and the faithful rank in the paper are equivalent.


I think you are right that the interpretation is reversed if the location of the computed data averaged prior is not correct. For over and under dispersion I think it should not matter. Visually with the same data:

plot1 plot2