# Help System (web edition)

```CORRTEST DATA1(VAR1,VAR2),DATA2(VAR1,VAR2),L
tests the equality of correlation coefficients in two samples
and
CORRTEST DATA(VAR1,VAR2),L
tests whether the correlation coefficient in one sample is 0.

If only sample correlation coefficient(s) and sample size(s)
are available, the following alternative forms of CORRRTEST
can be used:
CORRTEST TWO-SAMPLE,R1,N1,R2,N2,L
tests equality of correlation coefficients R1,R2 from samples
of sizes N1,N2, respectively.
CORRTEST ONE-SAMPLE,R,N,R0,L
tests the hypothesis R=R0 from a sample of size N.
Parameters can be given either as numeric constants or through
specification like R1=0.5679 .
In these alternatives the standard test based on Fisher's
z transformation is used. However, in the latter case when
R0=0 the standard t test is used.

CORRTEST DATA1(VAR1,VAR2),DATA2(VAR1,VAR2),L
for Survo data DATA1 and DATA2 (no IND, CASES, SELECT specifications
are accepted; see COMPARE?)
compares correlation coefficients in two samples by using the test
statistics U=[Fisher(R1,N1)-Fisher(R2,N2)]/sqrt[1/(N1-3)+1/(N2-3)]
where R1 and R2 are sample correlation coefficients, N1 and N2 sample sizes,
and Fisher(R,N)=0.5*sqrt(N-3)*log[(1+R)/(1-R)] .
If the samples are from bivariate normal distributions with the same
correlation coefficient, U is asymptotically N(0,1) and this approximation
is good already for rather small sample sizes.
However, in non-normal cases the normal approximation of U may be poor.
Therefore the P value (one-sided test) is calculated also by simulation.
Both data sets are standardized (means=0, std.devs=1) and these modified
data sets are combined. From this data set of N1+N2 observations N1 pairs
of values are taken at random as `sample' 1 and the other pairs form `sample' 2.
The U value of this randomized pair of samples is computed and the
relative frequency of U's exceeding the original U value is counted
while repeating the randomization process.

Maximum number of replicates is given by SIMUMAX (default 10000000).
The seed number of the random number generator (either 'rand' or 'urand')
is given by RAND (default RAND=rand(123456789). See RAND? .
The process may be interrupted by pressing any key.
The results are displayed after each 100 replicates as a table of the form

N           P               Confidence interval (level=0.95)
# of replicates   Estimate of P                lower limit
s.e.  Standard error               upper limit

The confidence level for P is set by CONF=p (0.8<p<1). Default is CONF=0.95

...........................................................................
Example:
DATA K1:(X,Y) 3,3 3,4 2,3 3,4 2,2 1,2 5,6 3,2 END
DATA K2:(X,Y) 3,2 5,4 5,2 3,1 2,2 3,4 4,4 2,4 3,2 2,3 END

CORRTEST K1(X,Y),K2(X,Y),CUR+1  / RAND=rand(19962)
Comparing correlation coefficients in 2 samples:
Sample 1: Data K1, Variables X,Y  N1=8 R1=0.83887
Sample 2: Data K2, Variables X,Y  N2=10 R2=0.12069
Test based on Fisher's z 1.87189 Normal approximation P=0.0306107
N    P       Confidence interval (0.95)
5176600 0.06230228 0.06209407 lower limit
s.e. 0.00010623 0.06251050 upper limit

CORRTEST DATA(VAR1,VAR2),L
tests on the basis of the sample whether the correlation coefficient is 0.
The usage is otherwise similar to the two-sample version.
First the standard test based on the transformation to t distribution
is performed.
In the randomized test the values of the second variable are randomly
permuted in each replicate.
P values for both 1- and 2-sided tests are computed.

...........................................................................
DATA K1:(X,Y) 3,3 3,4 2,3 3,4 2,2 1,2 5,6 3,2 END

CORRTEST K1(X,Y),CUR+1  / RND=rand(19962)         SIMUMAX=1000000
Testing hypothesis correlation coefficient = 0:
Sample: Data K1, Variables X,Y  N=8 R=0.83887
Standard t test value 3.77492  P=0.00461763 (2-tailed P=0.00923526)
1-tailed test         2-tailed test
N   P          Conf.int.  P          Conf.int.   (0.95)
1000000 0.01772600 0.01746738 0.02131400 0.02103092 lower limit
s.e. 0.00013195 0.01798462 0.00014443 0.02159708 upper limit