b{R}\)</span> are the bounds, with <span class="math inline">\(\alpha &lt; \beta\)</span>, then <span class="math inline">\(y \in (\alpha,\beta)\)</span> has a density defined as <span class="math display">\[
\textsf{triangle}(y \mid \alpha,\beta)
=
\frac{1}{(\beta - \alpha)^2}
\cdot
\textrm{min}(y - \alpha, \beta - y).
\]</span></p>
<p>The general form of triangle can be coded in Stan as follows.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode stan code-with-copy"><code class="sourceCode stan">