I have a model where the different observations may be specified by different distributions. I’m trying to vectorize this in order to get the performance to a reasonable level. The data is a ragged array and I am specifying the model to use with an integer vector. I can’t seem to figure out how to accomplish this in Stan.
Basically the data looks like this:
model_to_use = [1, 1, 1, 1, 2, 2, 2 ];
observations = [1.6, 1.7, 1.7, 1.7, 80, 91, 99];
what I want to accomplish is:
xxx[1:4] = bernoulli_lpmf( observations[model_to_use ==1] | 1.75);
xxx[5:7] = bernoulli_lpmf( observations[model_to_use ==2] | 91);
Is there a way to accomplish this through vectorizing, or some other method? Thanks!
-Chris