# Bootstrap test for correlation coefficient

I want to test the hypothesis that correlation coefficient between X and Y is 0 with a bootstrap, however I don't know which is a correct way to construct bootstrap samples. I have several ideas, which may be wrong:

1) randomly permute Y among X's as in permutation test, but sample Y with replacement

2) permute Y among X's without replacement and sample pairs (X,Y) with replacement

Could you please tell me the right way to do bootstrapping in this case and justify it? Thank a lot!

-

## 2 Answers

Just sample pairs (X,Y) with replacement. You should not be permuting anything.

-
As I understand then I will get the sampling distribution of correlation coefficient centered around the value (e.g. 0.2), which I observe in the original sample. And to test H_0 I need to take p-value, which is a proportion of bootstrapped correlations less than 0? But then it doesn't look like a p-value –  user2575760 Jun 13 at 10:52
Yes. How does that not look like a p-value? –  zkurtz Jun 13 at 11:42
Caveat 1: if H_0 is that the true proportion = 0, then you want a 2-sided test, which I believe means that you would just multiply the above-described p-value by 2. –  zkurtz Jun 13 at 11:45
Caveat 2: If your sample is small (not sure what small means), I suspect the p-value estimate will be a little biased, and corrections for this may exist -- just something to watch out for. –  zkurtz Jun 13 at 11:47

If you sample pairs of (X,Y) with replacement, then you are bootstrapping and it will give you the variance (or other measure of spread) of the correlation. You can use this to test your hypothesis.

If you permute either, then you are doing a permutation test and it will tell you how a correlation as large as the one you got occurs. This is not a bootstrap (at least, as I understand the term) but it will give you a p-value directly.

-