title: Is there a way to correlate two generated quantities in the generated quantities section?
body: <p>I am new to STAN. In my code I have generated two difference scores in the generated quantities section; delta[i,1] and delta[i,2] (see code below). My question is simple: how do I then correlate these two generated quantities in the generated quantities section? I am assuming STAN does not have a correlation function, is there an &quot;easy&quot; way to do this before I start writing my own correlation function?</p>
  <p>Thank you!</p>
  <pre><code>generated quantities {
    matrix[N,2] delta;
   
    // Create difference scores, delta
    for (i in 1:N) {
      delta[i,1] = mu[i,2] - mu[i,1]; // Interference - Control at time 1
      delta[i,2] = mu[i,4] - mu[i,3]; // Interference - Control at time 2
    }
  </code></pre>