Assign cov in Likelihood of multi-variate Gaussian distribution


If I need to assign values to covariance in Likelihood (multi-variate Gaussian distribution), is it possible to do with the function provided in PYMC3 ? I know it sounds weird since the shape of Normal distribution is determined by its mu and mean, but I was wondering if it is possible…


Yes you can use MvNormal in PyMC3


Thanks a lot! But what does it mean with the shape here? I tried to find some information from the doc but didn’t have a clue…

vals = pm.MvNormal(‘vals’, mu=mu, cov=cov, shape=(5, 2))


The shape kwarg is not always clear but there is some recent effort to improve it. Currently, PyMC3 try to infer the shape of a Random Variable internally given the parameters that define it. For example, doing pm.Normal('a', mu=np.zeros(5), sd=1) gives the param shape (5,). For example, using MvNormal if you have a cov.shape = (2, 2), then by default the random variable will have a shape (2,).
When you want to define multiple variables that follow the same distribution, instead of repeatly calling eg pm.Normal(...), it is often easier to define a shape to indicate repetition. The tricky part here is that you need to make sure the shape has no conflict with the shape of the parameters that define it. There is some information in the doc here:


Thanks a lot for the reply. :slightly_smiling_face: