Hi everyone,
I am working on an unpoolded model in which I am drawing 4000 samples from the posterior distribution of the parameters of the individual models. There are a total of 6 modelling distributions.
I want to now sample new data from a new event. In this case I need to sample once from the prior distribution ( which would be my new event) and now condition on this parameter I want to sample N times from the sampling distribution.
To do so I have:
generated quantities {
real mu_7 = normal_rng(0,1);
real sigma_7 = inv_chi_square_rng(10);
real y_7 = normal_rng( mu_7, sigma_7 );
}
With this I have observed that mu_7
is sampled 4000 times and for each of this sample one y_7
is sampled. I have been working on other alternatives such as:
real mu_7 = normal_rng(0,1);
real sigma_7 = inv_chi_square_rng(10);
array[4000] real y_7;
for (n in 1:4000){
y_7[n] = normal_rng( mu_7, sigma_7 );
}
However this creates 4000 y_7
variables each one with 4000 samples. How can I just sample once from the prior distribution and then N times from the sampling distribution?
Thank you.