Skip to main content

StatsLinearCorrelationTest

StatsLinearCorrelationTest [/ALPH=alpha /T=k /RHO=rhoValue /Q/Z] waveA, waveB

The StatsLinearCorrelationTest operation performs correlation tests on waveA and waveB, which must be real valued numeric waves and must have the same number of points. Output is to the W_StatsLinearCorrelationTest wave in the current data folder or optionally to a table.

Flags

/ALPH=valSets the significance level (default val =0.05).
/CIcomputes confidence intervals for the correlation coefficient.
/DEST=dstWaveSpecify the destination wave for the correlation test results. If you do not specify this flag, the results are stored in the wave W_StatsLinearCorrelationTest in the current data folder.
This flag was added in Igor Pro 10.00.
/FREECreates the user-specified destination wave as a free wave.
/FREE is allowed only in functions, and only if the destination waves are simple names or wave reference structure fields.
See Free Waves for more discussion.
The /FREE flag was added in Igor Pro 10.00.
/QNo results printed in the history area.
/RHO=rhoValueTests hypothesis that the correlation has a nonzero value
/T=kDisplays results in a table. k specifies the table behavior when it is closed.
k =0:Normal with dialog (default).
k =1:Kills with no dialog.
k =2:Disables killing.
/ZIgnores errors.

Details

The linear correlation tests start by computing the linear correlation coefficient for the n elements of both waves:

r=i=1nXiYi1ni=1nXii=1nYi(i=1nXi21n(i=1nXi)2)(i=1nYi21n(i=1nYi)2)r=\frac{\displaystyle \sum_{i=1}^{n} X_{i} Y_{i}-\frac{1}{n} \sum_{i=1}^{n} X_{i} \sum_{i=1}^{n} Y_{i}}{\displaystyle \sqrt{\left(\sum_{i=1}^{n} X_{i}^{2}-\frac{1}{n}\left(\sum_{i=1}^{n} X_{i}\right)^{2}\right)\left(\sum_{i=1}^{n} Y_{i}^{2}-\frac{1}{n}\left(\sum_{i=1}^{n} Y_{i}\right)^{2}\right)}}

.

Next it computes the standard error of the correlation coefficient

sr=1r2n2\displaystyle s r=\sqrt{\frac{1-r^{2}}{n-2}}

.

The basic test is for hypothesis H0: the correlation coefficient is zero, in which case t and F statistics are applicable. It computes the statistics:

t=r/sr\displaystyle t=r / s r

and

F=(1+r)/(1r)\displaystyle F=(1+|r|) /(1-|r|)

,

and then the critical values for one and two tailed hypotheses (designated by tc1, tc2, Fc1, and Fc2 respectively). Critical value for r are computed using

rci=tc2tc2+n\displaystyle \mathrm{rc}_{\mathrm{i}}=\sqrt{\frac{t_{c}^{2}}{t_{c}^{2}+n}}

,

where i takes the values 1 or 2 for one and two tailed hypotheses. Finally, the operation computes the power of the test at the alpha significance level for both one and two tails (Power1 and Power2).

If you use /RHO it uses the Fisher transformation to compute

 Fisher Z=12ln(1+r1r)\displaystyle \text { Fisher } \mathrm{Z}=\frac{1}{2} \ln \left(\frac{1+r}{1-r}\right)

,

 zeta =12ln(1+ρ1ρ)\displaystyle \text { zeta }=\frac{1}{2} \ln \left(\frac{1+\rho}{1-\rho}\right)

,

the standard error approximation

 sigmaZ =1/(n3)\displaystyle \text { sigmaZ }=\sqrt{1 /(n-3)}

,

 Zstatistic=(FisherZ-zeta)/sigmaZ \displaystyle \text { Zstatistic=(FisherZ-zeta)/sigmaZ }

,

and the critical values from the normal distribution Zci.

The confidence intervals are calculated differently depending on the hypothesis for the value of the correlation coefficient. If /RHO is not used the confidence intervals are computed using the critical value Fc2, otherwise they are computed using the critical Zc2 and sigmaZ.

References

See, in particular, Chapter 18 of:

Zar, J.H., Biostatistical Analysis, 4th ed., 929 pp., Prentice Hall, Englewood Cliffs, New Jersey, 1999.

See Also

Statistical Analysis, StatsCircularCorrelationTest, StatsMultiCorrelationTest, StatsRankCorrelationTest

Demos

Open Linear Correlation Demo.pxp