# LKJ prior throwing positivity exceptions

**URL:** https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421
**Category:** Modeling
**Tags:** fitting-issues
**Created:** [July 3, 2026, 11:44pm UTC](https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421 "2026-07-03T23:44:27Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [July 6, 2026, 1:26pm UTC](https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421/4 "2026-07-06T13:26:54Z")

</div>

This is almost surely an overflow issue where the value is overflowing to 1 in which causes the diagonal to be 0 and triggers the warning. As @kyle.hofmann noted the mathematics say this is impossible but with finite-precision computing this happens.

In the original model, the dimension of the correlation matrix is only 2. I almost never use the built-in Cholesky factor of correlation matrices for this. Since you can easily parameterize it with 1 parameter yourself as

```stan
real<lower=-1, upper=1> phi;

```

We, the Stan devs, need to update the parameterization to something like [Updated cholesky corr parameterization testing](https://discourse.mc-stan.org/t/updated-cholesky-corr-parameterization-testing/38827) which shouldn’t have this issue.

---

_[View the full topic](https://discourse.mc-stan.org/t/lkj-prior-throwing-positivity-exceptions/41421)._
