PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_tsa_multi_noise_bivar (g13cg)
Purpose
For a bivariate time series, nag_tsa_multi_noise_bivar (g13cg) 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.
Syntax
[
er,
erlw,
erup,
rf,
rfse,
ifail] = g13cg(
xg,
yg,
xyrg,
xyig,
stats,
l,
n, 'ng',
ng)
[
er,
erlw,
erup,
rf,
rfse,
ifail] = nag_tsa_multi_noise_bivar(
xg,
yg,
xyrg,
xyig,
stats,
l,
n, 'ng',
ng)
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
nag_tsa_multi_spectrum_bivar (g13ce) and
is the univariate spectrum estimate for series
. Confidence limits on the true spectrum are obtained using multipliers as described for
nag_tsa_uni_spectrum_lag (g13ca), 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
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
.
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
Parameters
Compulsory Input Parameters
- 1:
– double array
-
The
ng univariate spectral estimates,
, for the
series.
- 2:
– double array
-
The
ng univariate spectral estimates,
, for the
series.
- 3:
– double array
-
The real parts,
, of the
ng bivariate spectral estimates for the
and
series. The
series leads the
series.
- 4:
– double array
-
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:
– double array
-
The four 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:
– int64int32nag_int scalar
-
, the frequency division of the spectral estimates as
. 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.
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:
– int64int32nag_int scalar
-
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_multi_spectrum_lag (g13cc) or
nag_tsa_multi_spectrum_daniell (g13cd) which calculated the smoothed sample cross spectrum.
n is used in calculating the impulse response function standard error (
rfse).
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
xg,
yg,
xyrg,
xyig. (An error is raised if these dimensions are not equal.)
The number of spectral estimates in each of the arrays
xg,
yg,
xyrg,
xyig. It is also the number of noise spectral estimates.
Constraint:
.
Output Parameters
- 1:
– double array
-
The
ng estimates of the noise spectrum,
at each frequency.
- 2:
– double scalar
-
The noise spectrum lower limit multiplying factor.
- 3:
– double scalar
-
The noise spectrum upper limit multiplying factor.
- 4:
– double array
-
The impulse response function. Causal responses are stored in ascending frequency in to and anticipatory responses are stored in descending frequency in to .
- 5:
– double scalar
-
The impulse response function standard error.
- 6:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_tsa_multi_noise_bivar (g13cg) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | . |
- W
-
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.
- W
-
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.
- W
-
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.
- W
-
A calculated value of the squared coherency exceeds . For this frequency the squared coherency is reset to with the consequence that the noise spectrum is zero and the contribution to the impulse response function at this frequency is zero.
-
-
On entry, | , |
or | l has a prime factor exceeding , |
or | l has more than prime factors, counting repetitions. |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
If more than one failure of 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.
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.
Further Comments
The time taken by
nag_tsa_multi_noise_bivar (g13cg) 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 for a pair of time series. It calls nag_tsa_multi_noise_bivar (g13cg) to calculate the noise spectrum and its confidence limits multiplying factors, the impulse response function and its standard error. It then prints the results.
Open in the MATLAB editor:
g13cg_example
function g13cg_example
fprintf('g13cg example results\n\n');
xg = [ 2.03490; 0.51554; 0.07640;
0.01068; 0.00093; 0.00100;
0.00076; 0.00037; 0.00021];
yg = [21.97712; 3.29761; 0.28782;
0.02480; 0.00285; 0.00203;
0.00125; 0.00107; 0.00191];
xyrg = ...
[-6.54995; 0.34107; 0.12335;
-0.00514; -0.00033; -0.00039;
-0.00026; 0.00011; 0.00007];
xyig = ...
[ 0.00000; -1.19030; 0.04087;
0.00842; 0.00032; -0.00001;
0.00018; -0.00016; 0.00000];
ng = numel(xg);
stats = [30.00000; 0.63858; 1.78670; 0.33288];
l = int64(16);
n = int64(296);
[er, erlw, erup, rf, rfse, ifail] = ...
g13cg( ...
xg, yg, xyrg, xyig, stats, l, n);
fprintf(' Noise spectrum\n');
for j=1:ng
fprintf('%5d%16.4f\n', j-1, er(j))
end
fprintf('\nNoise spectrum bounds multiplying factors\n');
fprintf('Lower = %10.4f Upper = %10.4f\n\n', erlw, erup);
fprintf('Impulse response function\n\n');
for j=1:l
fprintf('%5d%16.4f\n', j-1, rf(j))
end
fprintf('\nImpulse response function standard error = %10.4f\n', rfse);
g13cg example results
Noise spectrum
0 0.8941
1 0.3238
2 0.0668
3 0.0157
4 0.0026
5 0.0019
6 0.0011
7 0.0010
8 0.0019
Noise spectrum bounds multiplying factors
Lower = 0.6298 Upper = 1.8291
Impulse response function
0 -0.0547
1 0.0586
2 -0.0322
3 -0.6956
4 -0.7181
5 -0.8019
6 -0.4303
7 -0.2392
8 -0.0766
9 0.0657
10 -0.1652
11 -0.0439
12 -0.0494
13 -0.0384
14 0.0838
15 -0.0814
Impulse response function standard error = 0.0863
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015