I am trying to implement this Nested MCMC on RStan, i am not sure if it is possible!
for s = 1, . . . , N1,
Sample θ1(s) ~ p(y1|θ1) p(θ1)
For s = 1,…,N1,
Sample θ2(s) ~ p(θ2|θ1(s) ,Y2)
Return (θ1(s) * θ2(s))
These are the various likelihood distributions for θ1, θ2, Y1, Y2
Y1 = (Y1.1,Y1.2 . . . , Y1.n1).
Y1.i ∼ N (θ1, 1) for all 1 ≤ i ≤ n1.
A prior distribution for θ1 is N (0, λ1^-1).
Y1 = (Y2.1,Y2.2 . . . , Y2.n2). Y2.i~ N (θ1 + θ2, 1) for all 1 ≤ i ≤ n2.
The prior distribution on θ2 is N (0, λ2^-1).
The value of θ1* is set as 0, the value of θ2* is set as 1.
n1 is set as 100 and n2 = 1000,
Furthermore, we use λ1 = 1 and λ2 = 100.
I am able to do Part 1 on Stan, I am just not sure how to use the θ1 samples from Step 1 and Implement it to Step 2.
Sorry to inconvenience anyone!