Is there some way to inform the chain at each step by adding data together? For each chain, I want to add a vector of data to another vector of data.
For example, I would do a for loop when using MH.
data {
int nsteps;
vector[10] y;
matrix [10, nsteps] x;
}
model{
for(i in 1:nsteps){
y = y + x[,i];
}
You may run the same instance of Stan program consequentially by updating the data and the priors from previous runs. I am not sure about purpose of this exercise, though
I’m not sure whst you mesn with step.
If you mean iteration, then no, Stan does not have information about the current iteration number accessible.
Thank you, yes I meant each iteration. It would be a vector of random variables, so the actual iteration number would not be important just that it is added during each iteration.
If you have a vector of random variables and you want to use the entire vector each iteration, then you can simply define the vector as data.
If you want to use only a random subset from the vector in each iteration, this is not supported by Stan.
got it, thanks for clarifying.