 can be coded directly in the generated quantities block of
the program. Here’s an example of the direct (non-sampling) approach.</p>
<pre><code>data {
  int&lt;lower = 0&gt; N_tilde;
  vector[N_tilde] y_tilde;
  ...
generated quantities {
  vector[N_tilde] log_p_y_tilde;
  for (n in 1:N_tilde)
    log_p_y_tilde[n]
      = log_mix(lambda,
                normal_lpdf(y_tilde[n] | mu[1], sigma[1])
                normal_lpdf(y_tilde[n] | mu[2], sigma[2]));
}</code></pre>
<p>It is a bit of a bother afterward