For a bivariate time series, g13cf calculates the gain and phase together with lower and upper bounds from the univariate and bivariate spectra.

Syntax

C#
public static void g13cf(
	double[] xg,
	double[] yg,
	double[] xyrg,
	double[] xyig,
	int ng,
	double[] stats,
	double[] gn,
	double[] gnlw,
	double[] gnup,
	double[] ph,
	double[] phlw,
	double[] phup,
	out int ifail
)
Visual Basic
Public Shared Sub g13cf ( _
	xg As Double(), _
	yg As Double(), _
	xyrg As Double(), _
	xyig As Double(), _
	ng As Integer, _
	stats As Double(), _
	gn As Double(), _
	gnlw As Double(), _
	gnup As Double(), _
	ph As Double(), _
	phlw As Double(), _
	phup As Double(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g13cf(
	array<double>^ xg, 
	array<double>^ yg, 
	array<double>^ xyrg, 
	array<double>^ xyig, 
	int ng, 
	array<double>^ stats, 
	array<double>^ gn, 
	array<double>^ gnlw, 
	array<double>^ gnup, 
	array<double>^ ph, 
	array<double>^ phlw, 
	array<double>^ phup, 
	[OutAttribute] int% ifail
)
F#
static member g13cf : 
        xg : float[] * 
        yg : float[] * 
        xyrg : float[] * 
        xyig : float[] * 
        ng : int * 
        stats : float[] * 
        gn : float[] * 
        gnlw : float[] * 
        gnup : float[] * 
        ph : float[] * 
        phlw : float[] * 
        phup : float[] * 
        ifail : int byref -> unit 

Parameters

xg
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On entry: the ng univariate spectral estimates, fxxω, for the x series.
yg
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On entry: the ng univariate spectral estimates, fyyω, for the y series.
xyrg
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On entry: the real parts, cfω, of the ng bivariate spectral estimates for the x and y series. The x series leads the y series.
xyig
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On entry: the imaginary parts, qfω, of the ng bivariate spectral estimates for the x and y series. The x series leads the y 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.
ng
Type: System..::..Int32
On entry: the number of spectral estimates in each of the arrays xg, yg, xyrg and xyig. It is also the number of gain and phase estimates.
Constraint: ng1.
stats
Type: array<System..::..Double>[]()[][]
An array of size [4]
On entry: the four associated statistics for the univariate spectral estimates for the x and y series. stats[0] contains the degrees of freedom, stats[1] and stats[2] contain the lower and upper bound multiplying factors respectively and stats[3] holds the bandwidth.
Constraint: stats[0]3.0.
gn
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng gain estimates, G^ω, at each frequency ω.
gnlw
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng lower bounds for the ng gain estimates.
gnup
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng upper bounds for the ng gain estimates.
ph
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng phase estimates, ϕ^ω, at each frequency ω.
phlw
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng lower bounds for the ng phase estimates.
phup
Type: array<System..::..Double>[]()[][]
An array of size [ng]
On exit: the ng upper bounds for the ng phase estimates.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

Estimates of the gain Gω and phase ϕω of the dependency of series y on series x at frequency ω are given by
G^ω=Aωfxxωϕ^ω=arccoscfωAω,if ​qfω0ϕ^ω=2π-arccoscfωAω,if ​qfω<0.
The quantities used in these definitions are obtained as in [Description] in g13ce.
Confidence limits are returned for both gain and phase, but should again be taken as very approximate when the coherency Wω, as calculated by g13ce, is not significant. These are based on the assumption that both G^ω/Gω-1 and ϕ^ω are Normal with variance
1d1Wω-1.
Although the estimate of ϕω is always given in the range 0,2π, no attempt is made to restrict its confidence limits to this range.

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

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry,ng<1,
orstats[0]<3.0.
ifail=2
A bivariate spectral estimate is zero. For this frequency the gain and the phase and their bounds are set to zero.
ifail=3
A univariate spectral estimate is negative. For this frequency the gain and the phase and their bounds are set to zero.
ifail=4
A univariate spectral estimate is zero. For this frequency the gain and the phase and their bounds are set to zero.
ifail=5
A calculated value of the squared coherency exceeds 1.0. For this frequency the squared coherency is reset to 1.0 in the formulae for the gain and phase bounds.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value
If more than one failure of types 2, 3, 4 and 5 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.

Accuracy

All computations are very stable and yield good accuracy.

Parallelism and Performance

None.

Further Comments

The time taken by g13cf is approximately proportional to ng.

Example

This example reads the set of univariate spectrum statistics, the two univariate spectra and the cross spectrum at a frequency division of 2π20 for a pair of time series. It calls g13cf to calculate the gain and the phase and their bounds and prints the results.

Example program (C#): g13cfe.cs

Example program data: g13cfe.d

Example program results: g13cfe.r

See Also