title: How to do: Correlation with "blocks" (or - "repeated measures" ?!)?
body: <p>I have the following setup to analyse:
  We have about 150 subjects, and for each subject we performed a pair of tests (under different conditions) 18 times.
  The 18 different conditions of the test are complementary, in such a way so that if we where to average over the tests (for each subject), we would get no correlation between the tests (between subjects).
  What we wish to know is the correlation (and P value) between the tests, in within subjects, but over all the subjects.</p>
  
  <p>The way I did this by now was to perform the correlation for each subject, and then look at the distribution of the correlations received so to see if it's mean is different then 0.
  But I suspect there might be a better way for answering the same question (someone said to me something about "geographical correlation", but a shallow search didn't help).</p>
  
  <p>p.s: I understand there might be a place here to do some sort of mixed model, but I would prefer to present a "correlation", and am not sure how to extract such an output from a mixed model.</p>
  
  <p>Also, here is a short dummy code to give an idea of what I am talking about:</p>
  
  <pre><code>attach(longley)
  N &lt;- length(Unemployed)
  block &lt;- c(
          rep( "a", N),
          rep( "b", N),
          rep( "c", N)
          )
  
  Unemployed.3 &lt;- c(Unemployed + rnorm(1),
                      Unemployed + rnorm(1),
                      Unemployed + rnorm(1))
  
  GNP.deflator.3 &lt;- c(GNP.deflator + rnorm(1),
                      GNP.deflator + rnorm(1),
                      GNP.deflator + rnorm(1))
  
  cor(Unemployed, GNP.deflator)
  cor(Unemployed.3, GNP.deflator.3)
  cor(Unemployed.3[block == "a"], GNP.deflator.3[block == "a"])
  cor(Unemployed.3[block == "b"], GNP.deflator.3[block == "b"])
  cor(Unemployed.3[block == "c"], GNP.deflator.3[block == "c"])
  (I would like to somehow combine the last three correlations...)
  </code></pre>
  
  <p>Any ideas will be welcomed.</p>
  
  <p>Best,
  Tal</p>