I am trying to achieve a Rao–Blackwellization of Metropolis–Hastings algorithm. In the paper by Robert et al. 2018, the following is given.
\begin{align} ℑ=&\frac{1}{T}\sum_{t=1}^Th(\theta^{(t)})=\frac{1}{T}\sum_{i=1}^Th(ϑ_t)\sum_{t=1}^T \mathbb{I}_{\theta^{(i)}=ϑ_t}\\ =&\frac{1}{T}\sum_{t=1}^Th(ϑ_t) \mathbb{E}\left[\sum_{i=1}^T \mathbb{I}_{\theta^{(i)}=ϑ_t}\middle|ϑ_1,...,ϑ_t\right] \\ =&\frac{1}{T}\sum_{t=1}^Th(ϑ_t)\left(\sum_{i=1}^T\mathbb P\left(\theta^{(i)}=ϑ_t|ϑ_1,...,ϑ_t\right)\right) \end{align}
where $(\theta^{(t)})$ is the Markov chain sequence, $(ϑ_t)$ is the sequence of proposal values. In the first line it is simply multiplying each of the proposal values by the number of times they have placed in the chain. It is another estimator of the mean. In the second line, it is conditioning this indicator function to the all of the proposal values, which are the sufficient statistics for the proposal values to be used in Rao–Blackwellization. And at the last step, it makes use of the conditional probabilities.
In my R code, I store the resulting chain, all of the proposal values, number of time they are accepted, the acceptance ratio of each proposal. But I couldn't get these things together and reach the Rao–Blackwellization.
I couldn't understand the $\mathbb P(\theta^{(i)}=ϑ_t | ϑ_1,...,ϑ_t)$. I have the acceptance ratio when $i=t$, but for the $\theta^{(i)}=ϑ_{t \neq i}$, how should I calculate this probability and achieve the Rao–Blackwellization of the Metropolis–Hastings?