I have a vector of observations
y (of length N) with associated indices (ii, jj, kk), each of length N, and an array of parameters
theta[i, j, k] in my model, and I would like to write a vectorised sampling statement equivalent to
for (l in 1:N) y[l] ~ normal(theta[ii[l], jj[l], kk[l]], sigma);
Is it possible to vectorise this directly? If not, does it make sense to do it indirectly, somehow, like vectorizing (“raveling”) the three-dimensional array and computing the indices to the vector manually?