Accessing elements of multivariate distribution

I would like to build a hierarchical model of sorts… essentially - I would like to sample

level_0 = Normal('level_0', mu=0, sigma=1, size=2)
mapping = [0,1,0,1,1]
mu = level_0[mapping] #this line clearly does not work - see below
level_1 = MvNormal('level_1', mu=mu, cov=np.eye(5)

what I’d like to do is sample the multivariate normal where the mean vector is:

[level_0[0], level_0[1], level_0[0], level_0[1], level_0[1]]

how can I efficiently construct this?

Apologies, I don’t understand wjat you’re trying to achieve. Could you try to restate it?

What do you mean by “this line does not work”?. The code looks valid. Do you mean it doesn’t do what you want it to do?

It does in fact work. I am complete bozo, please disregard. Thank you!

1 Like