NAG Library Routine Document
G13CEF
1 Purpose
For a bivariate time series, G13CEF calculates the cross amplitude spectrum and squared coherency, together with lower and upper bounds from the univariate and bivariate (cross) spectra.
2 Specification
SUBROUTINE G13CEF ( |
XG, YG, XYRG, XYIG, NG, STATS, CA, CALW, CAUP, T, SC, SCLW, SCUP, IFAIL) |
INTEGER |
NG, IFAIL |
REAL (KIND=nag_wp) |
XG(NG), YG(NG), XYRG(NG), XYIG(NG), STATS(4), CA(NG), CALW(NG), CAUP(NG), T, SC(NG), SCLW(NG), SCUP(NG) |
|
3 Description
Estimates of the cross amplitude spectrum
and squared coherency
are calculated for each frequency
as
where
- and are the co-spectrum and quadrature spectrum estimates between the series, i.e., the real and imaginary parts of the cross spectrum as obtained using G13CCF or G13CDF;
- and are the univariate spectrum estimates for the two series as obtained using G13CAF or G13CBF.
The same type and amount of smoothing should be used for these estimates, and this is specified by the degrees of freedom and bandwidth values which are passed from the calls of
G13CAF or
G13CBF.
Upper and lower
confidence limits for the cross amplitude are given approximately by
except that a negative lower limit is reset to
, in which case the approximation is rather poor. You are therefore particularly recommended to compare the coherency estimate
with the critical value
derived from the upper
point of the
-distribution on
degrees of freedom:
where
is the degrees of freedom associated with the univariate spectrum estimates. The value of
is returned by the routine.
The hypothesis that the series are unrelated at frequency , i.e., that both the true cross amplitude and coherency are zero, may be rejected at the level if . Tests at two frequencies separated by more than the bandwidth may be taken to be independent.
The confidence limits on are strictly appropriate only at frequencies for which the coherency is significant. The same applies to the confidence limits on which are however calculated at all frequencies using the approximation that is Normal with variance .
4 References
Bloomfield P (1976) Fourier Analysis of Time Series: An Introduction Wiley
Jenkins G M and Watts D G (1968) Spectral Analysis and its Applications Holden–Day
5 Parameters
- 1: – REAL (KIND=nag_wp) arrayInput
-
On entry: the
NG univariate spectral estimates,
, for the
series.
- 2: – REAL (KIND=nag_wp) arrayInput
-
On entry: the
NG univariate spectral estimates,
, for the
series.
- 3: – REAL (KIND=nag_wp) arrayInput
-
On entry: the real parts,
, of the
NG bivariate spectral estimates for the
and
series. The
series leads the
series.
- 4: – REAL (KIND=nag_wp) arrayInput
-
On entry: the imaginary parts,
, of the
NG bivariate spectral estimates for the
and
series. The
series leads the
series.
Note: the two univariate and the bivariate spectra must each have been calculated using the same method of smoothing. For rectangular, Bartlett, Tukey or Parzen smoothing windows, the same cut-off point of lag window and the same frequency division of the spectral estimates must be used. For the trapezium frequency smoothing window, the frequency width and the shape of the window and the frequency division of the spectral estimates must be the same. The spectral estimates and statistics must also be unlogged.
- 5: – INTEGERInput
-
On entry: the number of spectral estimates in each of the arrays
XG,
YG,
XYRG and
XYIG. It is also the number of cross amplitude spectral and squared coherency estimates.
Constraint:
.
- 6: – REAL (KIND=nag_wp) arrayInput
-
On entry: the four associated statistics for the univariate spectral estimates for the and series. contains the degrees of freedom, and contain the lower and upper bound multiplying factors respectively and contains the bandwidth.
Constraints:
- ;
- ;
- .
- 7: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG cross amplitude spectral estimates
at each frequency of
.
- 8: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG lower bounds for the
NG cross amplitude spectral estimates.
- 9: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG upper bounds for the
NG cross amplitude spectral estimates.
- 10: – REAL (KIND=nag_wp)Output
-
On exit: the critical value for the significance of the squared coherency, .
- 11: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG squared coherency estimates,
at each frequency
.
- 12: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG lower bounds for the
NG squared coherency estimates.
- 13: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the
NG upper bounds for the
NG squared coherency estimates.
- 14: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, | , |
or | , |
or | , |
or | , |
or | . |
-
A bivariate spectral estimate is zero. For this frequency the cross amplitude spectrum and squared coherency and their bounds are set to zero.
-
A univariate spectral estimate is negative. For this frequency the cross amplitude spectrum and squared coherency and their bounds are set to zero.
-
A univariate spectral estimate is zero. For this frequency the cross amplitude spectrum and squared coherency and their bounds are set to zero.
-
A calculated value of the squared coherency exceeds . For this frequency the squared coherency is reset to and this value for the squared coherency is used in the formulae for the calculation of bounds for both the cross amplitude spectrum and squared coherency. This has the consequence that both squared coherency bounds are .
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
If more than one failure of the types
,
,
and
occurs then the failure type which occurred at lowest frequency is returned in
IFAIL. However the actions indicated above are also carried out for failures at higher frequencies.
7 Accuracy
All computations are very stable and yield good accuracy.
8 Parallelism and Performance
Not applicable.
The time taken by G13CEF is approximately proportional to
NG.
10 Example
This example reads the set of univariate spectrum statistics, the two univariate spectra and the cross spectrum at a frequency division of for a pair of time series. It calls G13CEF to calculate the cross amplitude spectrum and squared coherency and their bounds and prints the results.
10.1 Program Text
Program Text (g13cefe.f90)
10.2 Program Data
Program Data (g13cefe.d)
10.3 Program Results
Program Results (g13cefe.r)