Dear All,
I'm interested in using JAGS to generate data from model1, and then
fit that generated data with Model2.
I need to do that because I can’t fit simultaneously the two models.
In order to take into account the variability of the estimates from Model1 and to correctly compute the credible intervals in Model2, I'd like to use the actual
measurements and the known errors to stochastically generate a bunch of
"data", and then fit that "data" using Model2 in JAGS.
I tried to do that by using the data block step, as explained in the JAGS manual.
I created a data block to generate "data" from the actual measurements and
associated measurement errors, and then model block.
However, as clearly described in the JAGS
manual, each node in the data block was forward sampled exactly once. What I
had needed was for each node to be forward sampled once per iteration , such
that the ultimate posterior distributions would reflect the full range of
variation possible in the "data.".

The code is as follow:

Data Block to sample MM from a normal distribution with mean M and precision M_prec, estimated from an external model (Model1)

data {

for (t in 1:100) {
MM[t,1] ~ dnorm(M[t,1],M_prec[t,1]) T(0,)

Start the Model2 that uses the MM sampled in the data block

model {

for (t in 1:100) {
MMM[t,1] ~ dpois(Q1[t,1])

Do you think this code is correct?
The MM data is sampled in each iteration from the data block?

If not, how can I solve my problem?

Thank you very much.
Leonardo Ventura