# Is the expected value of a correlation in a randomly permuted sample zero?

Let's say we have two real valued data sets $$x$$ and $$y$$, both of length $$n$$. I do not want to make any further assumptions regarding these data sets. We're interested in their correlation. For testing whether it may be zero, we can run a permutation test. It should be enough to keep $$x$$ fixed and just permute $$y$$.

Now I wonder, is the expected value of the correlation in the permuted data actually zero? I suspect it is (and I have run a test with 100000 permutations for two pretty wild $$x$$ and $$y$$ and it was compatible with mean zero). But how to prove that? (Note that we are not in the situation of i.i.d. sampling from the empirical distribution here, as we draw without replacement.)

OK, thinking a few minutes more brought me this: We're fixing the values of $$x$$ and $$y$$, so the denominator of the correlation is fixed, as are $$\bar x$$ and $$\bar y$$. For any fixed $$x_i$$ we can ignore the denominator and consider $$E(x_i-\bar x)(y_{\pi(i)}-\bar y)$$, where $$\pi$$ is the permutation. Now surely $$E(y_{\pi(i)}-\bar y)=0$$, as the expected value is taken over all permutations. So $$E[(x_i-\bar x)(y_{\pi(i)}-\bar y)|x_i]=0$$, and this still holds if the expected value is computed also over all $$x_i$$. (Not sure whether I even have to consider $$x_i$$ to be random, but for the argument it doesn't matter.)