;
  for (i in 1:(N - 1)) {
    K[i, i] = 1 + 0.1;
    for (j in (i + 1):N) {
      K[i, j] = exp(-0.5 * square(x[i] - x[j]));
      K[j, i] = K[i, j];
    }
  }
  K[N, N] = 1 + 0.1;
}
parameters {
  vector[N] y;
}
model {
  y ~ multi_normal(mu, K);
}</code></pre>
<p>The above model can also be written more compactly using the specialized
covariance function that implements the exponentiated quadratic kernel.</p>
<pre><code>data {
  int&lt;lower=1&gt; N;
  real x[N];
}
transformed data {
  matrix[N, N] K = c