I could implement SBC as follows. To make rank statistics for multi parameters, I have to add both ranks_
and pars_
.
In page 7 of the SBC paper , the rank statistics is defined by
\sum\mathbb{I}[ \theta_l < \tilde{\theta}]
But the following code, it seems like following
\sum\mathbb{I}[ \theta_l > \tilde{\theta}].
Is the reverse inequality used in program? Or I am wrong? The definition is changed?
generated quantities { // these adhere to the conventions above
int h_[C];
int f_[C];
vector [3 + C - 1] pars_;
int ranks_[3 + C - 1];
ranks_[1] = w > w_;
ranks_[2] = m > m_;
ranks_[3] = v > v_;
for (cd in 1:(C - 1)) ranks_[cd+3] = dz[cd] > dz_[cd];
pars_[1] = w_;
pars_[2] = m_;
pars_[3] = v_;
for (cd in 1:(C - 1)) pars_[cd+3] = dz_[cd];
h_ = h;
f_ = f;
}