>.</p>
<p>In Stan, the LKJ transform is reformulated in terms of a Cholesky factor <span class="math inline">\(w\)</span>
of the final correlation matrix, defined for <span class="math inline">\(1 \leq i,j \leq K\)</span> by</p>
<p><span class="math display">\[
w_{i,j} =
\left\{
\begin{array}{cl}
0 &amp; \mbox{if } i &gt; j,
\\
1 &amp; \mbox{if } 1 = i = j,
\\
\prod_{i&#39;=1}^{i - 1} \left( 1 - z_{i&#39;\!,\,j}^2 \right)^{1/2}
&amp; \mbox{if } 1 &lt; i = j,
\\
z_{i,j} &amp; \mbox{if } 1 = i &lt; j, \mbox{ 