Aditya369 - 1 year ago 96

Python Question

In pymc3, a stochastic variable of array shape say 3 can be generated as follows

`y = Normal('y', mu, sigma, shape=3, observed=some_data)`

Now suppose that y depends on an array of parameters mu = [1,2,3] and sigma = [4,5,6] instead of single values, how would I specify it?

Answer Source

I wanted a way to do the something like following

```
for i in range(3):
y[i] = Normal(mu[i], sigma[i], observed=somedata[i])
```

The way to do it is to simply pass in a list of values.

```
y=Normal(mu, sigma, observed=somedata)
```

where mu and sigma are lists