# LKJ Cholesky Density derivation

**URL:** <https://discourse.mc-stan.org/t/lkj-cholesky-density-derivation/21731>\
**Category:** General\
**Created:** [April 7, 2021, 3:00pm UTC](https://discourse.mc-stan.org/t/lkj-cholesky-density-derivation/21731 "2021-04-07T15:00:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spinkney](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@spinkney](https://discourse.mc-stan.org/u/spinkney)\
**Post date:** [April 7, 2021, 3:00pm UTC](https://discourse.mc-stan.org/t/lkj-cholesky-density-derivation/21731/1 "2021-04-07T15:00:31Z")

</div>

The density of the LKJ cholesky is

\text{LkjCholesky}(L \mid \eta) \propto |J|\det(LL^T)^{\eta - 1} = \prod\_{k = 2}^K L\_{kk}^{K - k + 2\eta - 2}

which is from the Stan manual ( [24.2 Cholesky LKJ correlation distribution | Stan Functions Reference (mc-stan.org)](https://mc-stan.org/docs/2_26/functions-reference/cholesky-lkj-correlation-distribution.html)). I get where the 2\eta - 2 comes from, it is

\det(LL^T)^{\eta - 1} = [\det(L)^2]^{\eta - 1} = \prod\_{k=2}^K L\_{kk}^{2 \eta - 2} 

which implies that |J| = \prod\_{k=2}^K L\_{kk}^{K - k}. However, the Edelman handout ( see top of page 13 [z\_handout2.dvi (mit.edu)](http://web.mit.edu/18.325/www/handouts/handout2.pdf))  
has the jacobian for the Cholesky transform as

\det J = 2^K \prod\_{k = 1}^K L\_{kk}^{K + 1 - k} .

So where am I going wrong with this?

---

<div class="post-metadata">

**Author:** ![spinkney](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@spinkney](https://discourse.mc-stan.org/u/spinkney)\
**Post date:** [April 7, 2021, 3:06pm UTC](https://discourse.mc-stan.org/t/lkj-cholesky-density-derivation/21731/2 "2021-04-07T15:06:37Z")

</div>

Ok, the panic of posting jarred my stupidity into clarity. I guess that power becomes K - k since when k = 1 L is 1. Then in the log that 2^K is constant so we can drop it. Then we get the above.

---

<div class="post-metadata">

**Author:** ![martinmodrak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/martinmodrak/32/133_2.png) [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Post date:** [April 11, 2021, 8:24pm UTC](https://discourse.mc-stan.org/t/lkj-cholesky-density-derivation/21731/3 "2021-04-11T20:24:01Z")

</div>

Thanks for sharing, that might be useful for others who will wonder the same. Do I get it correctly that it is resolved? If so, could you mark your own answer as solution?
