xp}_{m = 1}^M \mu_m
= \textrm{max}(\mu)
+ \log \sum_{m = 1}^M \exp(\mu_m - \textrm{max}(\mu)).
\]</span> Pulling the maximum out preserves all of its precision. By subtracting the maximum, the terms <span class="math inline">\(\mu_m - \textrm{max}(\mu) \leq 0\)</span>, and thus will not overflow.</p>
<section id="stan-program" class="level3 unnumbered">
<h3 class="unnumbered anchored" data-anchor-id="stan-program">Stan program</h3>
<p>To evaluate the log predictive density of a model, it suffices to impleme