I know how to handle linear models where the observed data is of different lengths, but I’m not sure how to handle the same use-case when multiplying observed parameters of differing lengths. My only guess was to combine the observed parameters into a single tensor via tt.tensor.join
. This runs, but I wanted to make sure this was the correct way to go about it.
with pm.Model() as model:
a = pm.Normal('a', 0, 10)
b = pm.Normal('b', 0, 10, shape=2)
idx = [0,0,0,0,0,1,1,1,1,1,1]
obs0 = pm.Normal('y0', 0, 10, observed=[1, 2, 1, 2, 3])
obs1 = pm.Normal('y1', 0, 10, observed=[1, 2, 1, 2, 5, 6])
y = a + b[idx] * tt.tensor.join(0, obs0, obs1)
Thank you