Spearman Rank Correlation Examples

You can test rank correlation of two waves using the operation StatsRankCorrelationTest. In the first example we consider the two random waves shown in the figure below

Picture0

To run the test execute the command:

StatsRankCorrelationTest/T=1/Q data1,data2

The results are displayed in the Rank-Correlation Test table:

n100
sumDi2165316
sumTx0
sumTy0
SpearmanR0.0080048
Critical0.196777

The Spearman rank correlation coefficient (SpearmanR) is smaller than the critical value so we accept H0, i.e., that there is no correlation between the two waves.

By comparison, you can run the parametric test using the command:

StatsLinearCorrelationTest/T=1/Q data1,data2

results in:

n100
r-0.0377559
sr0.100943
rc10.16543
rc20.196551
t_Value-0.374031
tc11.66055
tc21.98447
F1.07847
Fc11.39644
Fc21.48927
Power10.0218772
Power20.00981472

Since F<Fc2 we accept H0 corresponding to no rank-correlation between data1 and data2.

The next example shows correlated waves:

Picture0

StatsRankCorrelationTest/T=1/Q data3,data4

The results are displayed in the Rank-Correlation Test table:

n100
sumDi249716
sumTx0
sumTy0
SpearmanR0.701674
Critical0.196777

With SpearmanR>Critical value we clearly reject H0 and conclude that data3 and data4 are rank-correlated. If we now compare with the parametric test:

StatsLinearCorrelationTest/T=1/Q data3,data4

The results of the parametric test are:

n100
r0.728588
sr0.0691906
rc10.16543
rc20.196551
t_Value10.5302
tc11.66055
tc21.98447
F6.36887
Fc11.39644
Fc21.48927
Power11
Power21

In this case F>Fc2 and we again reject H0 (no correlation) and conclude that the two waves are correlated.