In my model I have

t[i,j] = a[i] + b[j] + error

On the left hand side I have outer sum a[i] + b[j], how do I implement it in pymc?

Thank you!

In my model I have

t[i,j] = a[i] + b[j] + error

On the left hand side I have outer sum a[i] + b[j], how do I implement it in pymc?

Thank you!

I guess `a`

and `b`

are vectors? If so, it should just be a matter of broadcasting:

```
import pytensor.tensor as pt
x = pt.arange(5)[:, None] # Make column vector
outer = x + x.T
outer.eval() # check computation
Out:
>>> array([[0, 1, 2, 3, 4],
>>> [1, 2, 3, 4, 5],
>>> [2, 3, 4, 5, 6],
>>> [3, 4, 5, 6, 7],
>>> [4, 5, 6, 7, 8]])
```

2 Likes