# Matrix \\mu in multivariate normal

**URL:** <https://discourse.pymc.io/t/matrix-mu-in-multivariate-normal/3236>\
**Category:** Questions\
**Created:** [May 9, 2019, 6:58pm UTC](https://discourse.pymc.io/t/matrix-mu-in-multivariate-normal/3236 "2019-05-09T18:58:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thinc](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@thinc](https://discourse.pymc.io/u/thinc)\
**Post date:** [May 9, 2019, 6:58pm UTC](https://discourse.pymc.io/t/matrix-mu-in-multivariate-normal/3236/1 "2019-05-09T18:58:58Z")

</div>

Hi, we are trying to estimate a multivariate normal model: X\sim MVN(\mu,\Sigma). It is understandable that when \mu is passed as an n-dimentional vector, then \Sigma must be n\times n and its element ij denotes covariance between X\_i and X\_j.  
From docs:

> cov = np.array([[1., 0.5], [0.5, 2]])  
> mu = np.zeros(2)  
> vals = pm.MvNormal(‘vals’, mu=mu, cov=cov, shape=(5, 2))

However, we discovered by chance that \mu does not have to be a vector, but also a squared matrix. The model works, no error message is displayed, and we get quite nice results. But we do not understand HOW the model works exactly.

Questions:

- Does it interpret each row/column of the matrix as a multivariate normal variable?
- And what is the interpetation of \Sigma in this case?

Thanks in advance for any clues 🙂

Struggling researchers - Agata and Tomek

---

<div class="post-metadata">

**Author:** ![chartl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/chartl/32/1515_2.png) [@chartl](https://discourse.pymc.io/u/chartl)\
**Post date:** [May 9, 2019, 8:41pm UTC](https://discourse.pymc.io/t/matrix-mu-in-multivariate-normal/3236/2 "2019-05-09T20:41:40Z")

</div>

Each row of the matrix is treated as independent. It should be the same thing (but faster) as

`pm.MatrixNormal('vals', mu, np.diag(np.ones(5, dtype=np.int32)), cov, shape=(5,2))`

---

<div class="post-metadata">

**Author:** ![thinc](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@thinc](https://discourse.pymc.io/u/thinc)\
**Post date:** [May 10, 2019, 6:33am UTC](https://discourse.pymc.io/t/matrix-mu-in-multivariate-normal/3236/3 "2019-05-10T06:33:06Z")

</div>

Thank you kindly, Sir 🙂
