# Weird posterior for correlation structure using LKJ distribution

**URL:** <https://discourse.pymc.io/t/weird-posterior-for-correlation-structure-using-lkj-distribution/1639>\
**Category:** Questions\
**Created:** [August 3, 2018, 5:12am UTC](https://discourse.pymc.io/t/weird-posterior-for-correlation-structure-using-lkj-distribution/1639 "2018-08-03T05:12:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![falk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/falk/32/4421_2.png) [@falk](https://discourse.pymc.io/u/falk)\
**Post date:** [August 4, 2018, 10:23am UTC](https://discourse.pymc.io/t/weird-posterior-for-correlation-structure-using-lkj-distribution/1639/2 "2018-08-04T10:23:12Z")

</div>

I’ve never really understood what eta does (I think I observed that my results were independent of the value I set there). So I’ve taken the occasion and tried to play around with this:

- I can reproduce this with the code provided by @monteiro.
- I also fiddled with the prior (`pm.Bound(pm.HalfFlat, lower=0.00001)`, then with upper bound \> 3000) but still retrieve lower boundary eta
- bounding eta to \>1 makes it still converge to minimal values just above one (I thought \eta \approx \epsilon might be a lokal minimum when cutting off infinity for numeric reasons)
- When using [an old example by Austin Rochford](https://austinrochford.com/posts/2015-09-16-mvn-pymc3-lkj.html), which attaches a multivariate block of observations to the prior instead of just fitting the correlation matrix, eta (he called it `nu`) also takes very small values in posterior. ~~test\_eta2.py (1.4 KB) When leaving eta flexible, sampling is also not exactly fluent there, slowing down drastically at times, and chains fail late on.~~ EDIT: file contained mistake, new try: [test\_eta2.py](https://discourse.pymc.io/uploads/pymc3/original/2X/e/e8b9838eac648feedc485bdc57258b729210b8f3.py) (1.5 KB) still a small eta.

Note that this last case could be also done with `LKJCholeskyCov`, which also has an eta parameter. EDIT: when using this prior, the sampling is much faster [test\_eta3.py](https://discourse.pymc.io/uploads/pymc3/original/2X/c/c60c952a88693af0a24cb1cc07acbbbb3e5f077b.py) (1.8 KB). However, eta still remains close to zero.

The documentation in `pymc3/distributions/multivariate` says:

> For eta → oo the LKJ prior approaches the identity matrix.

So eta always tends to have a very small magnitude posterior. How come?

My understanding of the pymc3 code is not advanced enough to tell you what’s going on behind the scenes.  
I guess this is something for the developers! Thanks for clearing it up.

---

_[View the full topic](https://discourse.pymc.io/t/weird-posterior-for-correlation-structure-using-lkj-distribution/1639)._
