We now extend the approach for one sample hypothesis testing of the correlation coefficient to two samples.

Topics:

- Two independent sample pairs – this webpage
- Two dependent sample pairs with one sample in common (overlapping case)
- Two dependent sample pairs with no sample in common (non-overlapping case)

**Theorem 1**: Suppose *r*_{1} and* r*_{2} are as in the Theorem 1 of Correlation Testing via Fisher Transformation where *r*_{1} and* r*_{2} are based on independent samples and further suppose that *ρ*_{1} =* ρ*_{2}. If *z* is defined as follows, then *z* ∼ *N*(0,1).

__Proof__: By Theorem 1 of Correlation Testing via Fisher Transformation for *i* = 1, 2

By Property 1 and 2 of Basic Characteristics of the Normal Distribution it follows that

where *s* is as defined above. Since *ρ*_{1} =* ρ*_{2} it follows that *ρ´*_{1} =* ρ´*_{2}, and so

from which the result follows.

We can use Theorem 1 to test whether the correlation coefficients of two populations are equal based on taking a sample from each population and comparing the correlation coefficients of the samples.

**Example 1**: A sample of 40 couples from London is taken comparing the husband’s IQ with his wife’s. The correlation coefficient for the sample is .77. Is this significantly different from the correlation coefficient of .68 for a sample of 30 couples from Paris?

H_{0}: *ρ _{1} = ρ_{2}*

= FISHER(*r _{1}*) = FISHER(.77) = 1.020

= FISHER(*r _{2}*) = FISHER(.68) = 0.829

*s* = SQRT(1/(*n _{1}* – 3) + 1/(

*n*– 3)) = SQRT(1/37 + 1/27) = 0.253

_{2}*z* = (* _{ }*– )/

*s*= (1.020 – .829) / .253 = 0.755

p-value = 2(1 – NORMSDIST(*z*) = 1 – NORMSDIST(.522)) = 0.45

We next perform either one of the following tests:

p-value = .45 > .05 = *α*

*z _{crit} *= NORMSINV(1 –

*α*/2) = NORMSINV(.975) = 1.96 > .755 =

*z*

In either case the null hypothesis is not rejected.

Note that in Example 1 the couples from Paris are selected independently from the couples from London. A different test is required if the samples are dependent.

Click here for an example on how to perform Two Sample Hypothesis Testing for Correlation with Overlapping Dependent Samples.

Click here for an example on how to perform Two Sample Hypothesis Testing for Correlation with Non-overlapping Dependent Samples.

**Real Statistics Functions**: The following function is provided in the Real Statistics Resource Pack.

**Correl2Test**(*r*1*, n*1*, r*2*, n*2*, alpha, lab*): array function which outputs *z*, p-value (two-tailed), lower and upper (i.e. lower and upper bound of the 1 – alpha confidence interval), where *r*1 and *n*1 are the correlation coefficient and sample size for the first sample and *r*2 and *n*2 are similar values for the second sample. If *lab* = TRUE then the output takes the form of a 4 × 2 range with the first column consisting of labels, while if *lab* = False (default) then output takes the form of a 4 × 1 range without labels. If *alpha* is omitted it defaults to .05.

**Correl2Test**(R1, R2, R3, R4, *alpha, lab*) = CorrelTest(*r*1, *n*1, *r*2, *n*2, *alpha, lab*) where *r*1 = CORREL(R1, R2), *n*1 = the common sample size between R1 and R2 (i.e. the number of pairs from R1 and R2 which both contain numeric data), *r*2 = CORREL(R3, R4) and *n*2 = the common sample size between R3 and R4.

**Observation**: Correl2Test(.77,40,.68,30,.05) generated the values *z* = .755, p-value = .45, consistent with what we observed above, plus lower = -.296 and upper = .596. Since 0 is in the confidence interval (-.296, .596) the test is not significant and we cannot reject the null hypothesis that the two correlation coefficients are equal.

Hi and thank you for the nice informative pages.

Since I am not a very experienced user I must ask.

I use your correl2test(r1, n1, r2, n2, alpha, lab)

as follows =correl2test( 0,569;10190;0,641; 2039;0,05)

but not get only one number instead of 4

I get -4,652529256

By the way I have excel2010

Thank you in advance

Regards Gustaf

Gustaf,

Correl2Test is an array function and so you can’t simply highlight one cell and press the Enter key. You need to highlight a column range with at least 4 cells and press Ctrl-Shift-Enter. See Array Formulas and Functions for more details.

Charles

Thank you Charles,

I will check it out.

I had some trouble with your p-value also so I solved it like this:

The cell for the p-value: =IF(AW4>=0; 2*(1-NORM.DIST(AW4;0;1;TRUE));2*NORM.DIST(AW4;0;1;TRUE))

where AW4 is the z.

The NORM.DIST is a new function from Excel. The other one NORMSDIST does not work anymore apparently.

I have a question though. I now tested the hypothesis that of equality. What if I tested Ho: rho1>rho2. Any tips for me there?

I am very thankful for your commitment to these pages you offer by the way.

/Gustaf

Gustaf,

You could also use the formula =2*(1-NORM.DIST(ABS(AW4);0;1;TRUE)) or =2*(1-NORM.S.DIST(ABS(AW4);TRUE)).

The formula NORMSDIST still works on my computer. I understood that Excel still supports this function, but wants people to migrate to NORM.DIST.

I beleive that if you are testing Ho: rho1>rho2, then you should use a one-tail test, i.e. =1-NORM.S.DIST(ABS(AW4);TRUE).

Charles

Hi Charles,

I am seeking to compare either the Kendall’s Tau value of two independent samples or the Spearman’s Rho of two independent samples. That is I have an estimate of the correlation between x and y for sample 1 and that of sample 2. The samples are independent. However, the sample size in each group is small (n1=15 n2=35) and the data for x and y is not normal in either sample (this is the reason I would use either Kendall’s Tau or Spearmans’s Rho instead of Pearson’s in each of the samples).

Is there a test to compare the Kendall’s tau or the Spearman’s Rho of 2 independent samples?

Any guidance would be greatly appreciated.

-Maggie

Biostat II

Maggie,

If I remember correctly, with Spearman’s rho you are just calculating Pearson’s correlation on the ranks of the two pairs in the samples. If you are comparing two independent sample pairs, you should be able to use the test of two independent sample pairs described on the referenced webpage, but on the ranks not on the original data.

I don’t how to do this for Kendall’s tau.

Charles