Mixture of distribution combinations

I have two parameters (random variables):

vector[3] Alpha;
vector[2] Beta;

Alpha ~ normal(mu1, var1);
Beta ~ normal(mu2, var2);


The 5 means and 5 variances are estimated from the data (this is working for me, based on long-format data).
I would like to have another parameter where the mixture (combination/sum) of each combination between alpha and beta is shown.

vector[6] mixture; // 3 times 2=6 combinations
mixture ~ normal(mu1+mu2, var1+ var2 + 2*cov(1,2));

Is this possible within the .stan file or otherwise with the results in R? I was unsure what to look for… A nudge in the right direction is appreciated!

I am not sure if I understand your question correctly. So basically you want to compute the sum of all combinations of Beta and Alpha right? This can go into the generated quantities block, if you don’t want to use your mixture variable somewhere else in the Stan file. How about:

generated quantities {
vector[6] mixture;
mixture[1] = Alpha[1] + Beta[1];
mixture[2] = Alpha[1] + Beta[2];


1 Like