This is a program to compute the significances of correlations using
the random-phase method.  This method uses a Monte-Carlo approach
using random series with the property that they have the same
auto-correlation as the sample series.  Consequently this approach
works well with series that are serially correlated.

This program only works with time series that are of a power of 2 
as a simple power-of-2 FFT is used.  (The random phase method
is not limited to a power of two.)

v1.0 July 2000 W. Ebisuzaki CPC/NCEP/NWS/NOAA
   ebis@wesley.wwb.noaa.gov

Reference: Ebisuzaki, W, 1997: A method to estimate the statistical 
significance of a correlation when the data are serially correlated.  
J. of Climate, 10, 2147-2153.

-------------------------------------------------------------                   

Using the program on a linux machine:

$ make
  (short for cc -O2 r_phase.c ran1.c realft.c fftutil.c four1.c -lm)

$ r_phase sig n time-series-1  time-series-2


sig = statistical significance, ex. 0.01, 0.05
n = number of points in time series, must be a power of 2,
     ex. 16, 128
time-series-1 = text file with time series 1 (n points)
time-series-2 = text file with time series 2 (n points)

-------------------------------------------------------------                   

Definitions:

sample |corr| = absolute value of the correlation of the two input series

fraction of samples with larger |corr| = the fraction of random phase
	samples that had a larger |corr| than the sample

critical |corr| = the estimated |corr| where only a small fraction ("sig")
	of the random samples would have a larger |corr|.

-------------------------------------------------------------

Note: NSAMPLE (in r_phase.c) is the number of random sample
generated for the test.  The appropriate value of NSAMPLE
depends on the signficance level.  In general, as "sig" decreases,
NSAMPLE should increase.

-------------------------------------------------------------

example execution using two random time series

bash$ r_phase 0.01 64 x y
reading x
reading y
calculating
testing x and y (64 points) for 0.010000 significance
sample |corr| 0.078581,  fraction of samples with larger |corr| 0.519120
critical |corr| 0.304759 at 0.010000 sig level, 50000 random samples used