NAG Library Function Document
nag_tsa_noise_spectrum_bivar (g13cgc)
1 Purpose
For a bivariate time series, nag_tsa_noise_spectrum_bivar (g13cgc) 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.
2 Specification
#include <nag.h> |
#include <nagg13.h> |
void |
nag_tsa_noise_spectrum_bivar (const double xg[],
const double yg[],
const Complex xyg[],
Integer ng,
const double stats[],
Integer l,
Integer n,
double er[],
double *erlw,
double *erup,
double rf[],
double *rfse,
NagError *fail) |
|
3 Description
An estimate of the noise spectrum in the dependence of series
on series
at frequency
is given by
where
is the squared coherency described in G13GEF and
is the univariate spectrum estimate for series
. Confidence limits on the true spectrum are obtained using multipliers as described for G13CAF, but based on
degrees of freedom.
If the dependence of
on
can be assumed to be represented in the time domain by the one sided relationship
where the noise
is independent of
, then it is the spectrum of this noise which is estimated by
.
Estimates of the impulse response function
may also be obtained as
where Re indicates the real part of the expression. For this purpose it is essential that the univariate spectrum for
,
,and the cross spectrum,
be supplied to this function for a frequency range
where
denotes the integer part, the integral being approximated by a finite Fourier transform.
An approximate standard error is calculated for the estimates
. Significant values of
in the locations described as anticipatory responses in the argument array
rf, indicate that feedback exists from
to
. This will bias the estimates of
in any causal dependence of
on
.
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 Arguments
- 1:
xg[ng] – const doubleInput
-
On entry: the
ng univariate spectral estimates,
, for the
series.
- 2:
yg[ng] – const doubleInput
-
On entry: the
ng univariate spectral estimates,
, for the
series.
- 3:
xyg[ng] – const ComplexInput
-
On entry:
, of the
ng bivariate spectral estimates for the
and
series. The
series leads the
series.
Note: the two univariate and bivariate spectra must each have been calculated using the same amount of smoothing. 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.
- 4:
ng – IntegerInput
On entry: the number of spectral estimates in each of the arrays
xg,
yg and
xyg. It is also the number of noise spectral estimates.
Constraint:
.
- 5:
stats[] – const doubleInput
-
On entry: the 4 associated statistics for the univariate spectral estimates for the and series. contains the degree of freedom, and contain the lower and upper bound multiplying factors respectively and contains the bandwidth.
Constraints:
- ;
- ;
- .
- 6:
l – IntegerInput
On entry: the frequency division,
, of the spectral estimates as
, as input to
nag_tsa_spectrum_univar (g13cbc) and
nag_tsa_spectrum_bivar (g13cdc).
Constraints:
- ;
- The largest prime factor of l must not exceed , and the total number of prime factors of l, counting repetitions, must not exceed . These two restrictions are imposed by the internal FFT algorithm used.
- 7:
n – IntegerInput
-
On entry: the number of points in each of the time series
and
.
n should have the same value as
nxy in the call of
nag_tsa_spectrum_bivar_cov (g13ccc) or
nag_tsa_spectrum_bivar (g13cdc) which calculated the smoothed sample cross spectrum.
n is used in calculating the impulse response function standard error (
rfse).
Constraint:
.
- 8:
er[ng] – doubleOutput
-
On exit: the
ng estimates of the noise spectrum,
at each frequency.
- 9:
erlw – double *Output
-
On exit: the noise spectrum lower limit multiplying factor.
- 10:
erup – double *Output
-
On exit: the noise spectrum upper limit multiplying factor.
- 11:
rf[l] – doubleOutput
-
On exit: the impulse response function. Causal responses are stored in ascending frequency in to and anticipatory responses are stored in descending frequency in to .
- 12:
rfse – double *Output
-
On exit: the impulse response function standard error.
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_2_INT_ARG_CONS
-
On entry, while . These arguments must satisfy when .
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_BIVAR_SPECTRAL_ESTIM_ZERO
-
A bivariate 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.
- NE_FACTOR_GT
-
At least one of the prime factors of
l is greater than 19.
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call
and any array sizes. If the call is correct then please contact
NAG for
assistance.
- NE_REAL_ARG_GT
-
On entry, must not be greater than 1.0: .
- NE_REAL_ARG_LE
-
On entry, must not be less than or equal to 0.0: .
- NE_REAL_ARG_LT
-
On entry, must not be less than 3.0: .
On entry, must not be less than 1.0: .
- NE_SQUARED_FREQ_GT_ONE
-
A calculated value of the squared coherency exceeds one.
For this frequency the squared coherency is reset to one with the result that the noise spectrum is zero and the contribution to the impulse response function at this frequency is zero.
- NE_TOO_MANY_FACTORS
-
l has more than 20 prime factors.
- NE_UNIVAR_SPECTRAL_ESTIM_NEG
-
A bivariate 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.
- NE_UNIVAR_SPECTRAL_ESTIM_ZERO
-
A bivariate 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.
7 Accuracy
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.
8 Parallelism and Performance
Not applicable.
The time taken by nag_tsa_noise_spectrum_bivar (g13cgc) is approximately proportional to
ng.
10 Example
The example program reads the set of univariate spectrum statistics, the 2 univariate spectra and the cross spectrum at a frequency division of for a pair of time series. It calls nag_tsa_noise_spectrum_bivar (g13cgc) to calculate the noise spectrum and its confidence limits multiplying factors, the impulse response function and its standard error. It then prints the results.
10.1 Program Text
Program Text (g13cgce.c)
10.2 Program Data
Program Data (g13cgce.d)
10.3 Program Results
Program Results (g13cgce.r)