For a bivariate time series, g13cgf calculates the noise spectrum together with multiplying factors for the bounds and the impulse response function and its standard error, from the univariate and bivariate spectra.
where $W\left(\omega \right)$ is the squared coherency described in g13cef and ${f}_{yy}\left(\omega \right)$ is the univariate spectrum estimate for series $y$. Confidence limits on the true spectrum are obtained using multipliers as described for g13caf, but based on $(d-2)$ degrees of freedom.
If the dependence of ${y}_{t}$ on ${x}_{t}$ can be assumed to be represented in the time domain by the one sided relationship
where the noise ${n}_{t}$ is independent of ${x}_{t}$, then it is the spectrum of this noise which is estimated by ${f}_{y\mid x}\left(\omega \right)$.
Estimates of the impulse response function ${v}_{0},{v}_{1},{v}_{2},\dots \text{}$ may also be obtained as
where $\mathrm{Re}$ indicates the real part of the expression. For this purpose it is essential that the univariate spectrum for $x$, ${f}_{xx}\left(\omega \right)$, and the cross spectrum, ${f}_{xy}\left(\omega \right)$, be supplied to this routine for a frequency range
where $\left[\right]$ denotes the integer part, the integral being approximated by a finite Fourier transform.
An approximate standard error is calculated for the estimates ${v}_{k}$. Significant values of ${v}_{k}$ in the locations described as anticipatory responses in the argument array rf indicate that feedback exists from ${y}_{t}$ to ${x}_{t}$. This will bias the estimates of ${v}_{k}$ in any causal dependence of ${y}_{t}$ on ${x}_{t},{x}_{t-1},\dots \text{}$.
4References
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
5Arguments
1: $\mathbf{xg}\left({\mathbf{ng}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the ng univariate spectral estimates, ${f}_{xx}\left(\omega \right)$, for the $x$ series.
2: $\mathbf{yg}\left({\mathbf{ng}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the ng univariate spectral estimates, ${f}_{yy}\left(\omega \right)$, for the $y$ series.
3: $\mathbf{xyrg}\left({\mathbf{ng}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the real parts, $cf\left(\omega \right)$, of the ng bivariate spectral estimates for the $x$ and $y$ series. The $x$ series leads the $y$ series.
4: $\mathbf{xyig}\left({\mathbf{ng}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the imaginary parts, $qf\left(\omega \right)$, 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.
5: $\mathbf{ng}$ – IntegerInput
On entry: the number of spectral estimates in each of the arrays xg, yg, xyrg, xyig. It is also the number of noise spectral estimates.
Constraint:
${\mathbf{ng}}\ge 1$.
6: $\mathbf{stats}\left(4\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the four associated statistics for the univariate spectral estimates for the $x$ and $y$ series. ${\mathbf{stats}}\left(1\right)$ contains the degree of freedom, ${\mathbf{stats}}\left(2\right)$ and ${\mathbf{stats}}\left(3\right)$ contain the lower and upper bound multiplying factors respectively and ${\mathbf{stats}}\left(4\right)$ contains the bandwidth.
Constraints:
${\mathbf{stats}}\left(1\right)\ge 3.0$;
$0.0<{\mathbf{stats}}\left(2\right)\le 1.0$;
${\mathbf{stats}}\left(3\right)\ge 1.0$.
7: $\mathbf{l}$ – IntegerInput
On entry: $L$, the frequency division of the spectral estimates as $\frac{2\pi}{L}$. It is also the order of the FFT used to calculate the impulse response function. l must relate to the parameter ng by the relationship.
Constraint:
${\mathbf{ng}}=[L/2]+1$.
8: $\mathbf{n}$ – IntegerInput
On entry: the number of points in each of the time series $x$ and $y$. n should have the same value as nxy in the call of g13ccforg13cdf which calculated the smoothed sample cross spectrum. n is used in calculating the impulse response function standard error (rfse).
Constraint:
${\mathbf{n}}\ge 1$.
9: $\mathbf{er}\left({\mathbf{ng}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the ng estimates of the noise spectrum, ${\hat{f}}_{y\mid x}\left(\omega \right)$ at each frequency.
10: $\mathbf{erlw}$ – Real (Kind=nag_wp)Output
On exit: the noise spectrum lower limit multiplying factor.
11: $\mathbf{erup}$ – Real (Kind=nag_wp)Output
On exit: the noise spectrum upper limit multiplying factor.
12: $\mathbf{rf}\left({\mathbf{l}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the impulse response function. Causal responses are stored in ascending frequency in ${\mathbf{rf}}\left(1\right)$ to ${\mathbf{rf}}\left({\mathbf{ng}}\right)$ and anticipatory responses are stored in descending frequency in ${\mathbf{rf}}\left({\mathbf{ng}}+1\right)$ to ${\mathbf{rf}}\left({\mathbf{l}}\right)$.
13: $\mathbf{rfse}$ – Real (Kind=nag_wp)Output
On exit: the impulse response function standard error.
14: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $\mathrm{-1}$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $\mathrm{-1}$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $\mathrm{-1}$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $\mathrm{-1}$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $\mathrm{-1}$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases g13cgf may return useful information.
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.
${\mathbf{ifail}}=1$
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}\ge 1$.
On entry, ${\mathbf{ng}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ng}}\ge 1$.
On entry, ${\mathbf{stats}}\left(1\right)=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{stats}}\left(1\right)\ge 3.0$.
On entry, ${\mathbf{stats}}\left(2\right)=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{stats}}\left(2\right)>0.0$.
On entry, ${\mathbf{stats}}\left(2\right)=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{stats}}\left(2\right)\le 1.0$.
On entry, ${\mathbf{stats}}\left(3\right)=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{stats}}\left(3\right)\ge 1.0$.
${\mathbf{ifail}}=2$
A bivariate spectral estimate is zero. For this frequency the noise spectrum is set to zero, and the contribution to the impulse response function and its standard error is set to zero.
${\mathbf{ifail}}=3$
A univariate spectral estimate is negative. For this frequency the noise spectrum is set to zero, and the contributions to the impulse response function and its standard error are set to zero.
${\mathbf{ifail}}=4$
A univariate spectral estimate is zero. For this frequency the noise spectrum is set to zero and the contributions to the impulse response function and its standard error are set to zero.
${\mathbf{ifail}}=5$
A calculated value of the squared coherency exceeds $1.0$. For this frequency the squared coherency is reset to $1.0$ with the consequence that the noise spectrum is zero and the contribution to the impulse response function at this frequency is zero.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{ng}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{l}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ng}}={\mathbf{l}}/2+1$.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The computation of the noise is stable and yields good accuracy. The FFT is a numerically stable process, and any errors introduced during the computation will normally be insignificant compared with uncertainty in the data.
8Parallelism and Performance
g13cgf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13cgf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The time taken by g13cgf is approximately proportional to ng.
10Example
This example reads the set of univariate spectrum statistics, the two univariate spectra and the cross spectrum at a frequency division of $\frac{2\pi}{20}$ for a pair of time series. It calls g13cgf to calculate the noise spectrum and its confidence limits multiplying factors, the impulse response function and its standard error. It then prints the results.