hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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 yy on series xx at frequency ωω is given by
fyx(ω) = fyy(ω)(1W(ω)),
fyx(ω)=fyy(ω)(1-W(ω)),
where W(ω)W(ω) is the squared coherency described in nag_tsa_multi_spectrum_bivar (g13ce) and fyy(ω)fyy(ω) is the univariate spectrum estimate for series yy. Confidence limits on the true spectrum are obtained using multipliers as described for nag_tsa_uni_spectrum_lag (g13ca), but based on (d2)(d-2) degrees of freedom.
If the dependence of ytyt on xtxt can be assumed to be represented in the time domain by the one sided relationship
yt = v0xt + v1xt1 + + nt,
yt=v0xt+v1xt-1++nt,
where the noise ntnt is independent of xtxt, then it is the spectrum of this noise which is estimated by fyx(ω)fyx(ω).
Estimates of the impulse response function v0,v1,v2,v0,v1,v2, may also be obtained as
π
vk = 1/πRe((exp(ikω)fxy(ω))/(fxx(ω))),
0
vk=1π0πRe(exp(ikω)fxy(ω) fxx(ω) ) ,
where ReRe indicates the real part of the expression. For this purpose it is essential that the univariate spectrum for xx, fxx(ω)fxx(ω), and the cross spectrum, fxy(ω)fxy(ω), be supplied to this function for a frequency range
ωl = [(2πl)/L] ,  0l[L / 2],
ωl=[2πlL] ,  0l[L/2],
where [][] denotes the integer part, the integral being approximated by a finite Fourier transform.
An approximate standard error is calculated for the estimates vkvk. Significant values of vkvk in the locations described as anticipatory responses in the parameter array rf indicate that feedback exists from ytyt to xtxt. This will bias the estimates of vkvk in any causal dependence of ytyt on xt,xt1,xt,xt-1,.

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:     xg(ng) – double array
ng, the dimension of the array, must satisfy the constraint ng1ng1.
The ng univariate spectral estimates, fxx(ω)fxx(ω), for the xx series.
2:     yg(ng) – double array
ng, the dimension of the array, must satisfy the constraint ng1ng1.
The ng univariate spectral estimates, fyy(ω)fyy(ω), for the yy series.
3:     xyrg(ng) – double array
ng, the dimension of the array, must satisfy the constraint ng1ng1.
The real parts, cf(ω)cf(ω), of the ng bivariate spectral estimates for the xx and yy series. The xx series leads the yy series.
4:     xyig(ng) – double array
ng, the dimension of the array, must satisfy the constraint ng1ng1.
The imaginary parts, qf(ω)qf(ω), of the ng bivariate spectral estimates for the xx and yy series. The xx series leads the yy 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:     stats(44) – double array
The four associated statistics for the univariate spectral estimates for the xx and yy series. stats(1)stats1 contains the degree of freedom, stats(2)stats2 and stats(3)stats3 contain the lower and upper bound multiplying factors respectively and stats(4)stats4 contains the bandwidth.
Constraints:
  • stats(1)3.0stats13.0;
  • 0.0 < stats(2)1.00.0<stats21.0;
  • stats(3)1.0stats31.0.
6:     l – int64int32nag_int scalar
LL, the frequency division of the spectral estimates as (2π)/L 2π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.
Constraints:
  • ng = [L / 2] + 1ng=[L/2]+1;
  • The largest prime factor of l must not exceed 1919, and the total number of prime factors of l, counting repetitions, must not exceed 2020. These two restrictions are imposed by the internal FFT algorithm used.
7:     n – int64int32nag_int scalar
The number of points in each of the time series xx and yy. 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: n1n1.

Optional Input Parameters

1:     ng – 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: ng1ng1.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     er(ng) – double array
The ng estimates of the noise spectrum, yx(ω)f^yx(ω) at each frequency.
2:     erlw – double scalar
The noise spectrum lower limit multiplying factor.
3:     erup – double scalar
The noise spectrum upper limit multiplying factor.
4:     rf(l) – double array
The impulse response function. Causal responses are stored in ascending frequency in rf(1)rf1 to rf(ng)rfng and anticipatory responses are stored in descending frequency in rf(ng + 1)rfng+1 to rf(l)rfl.
5:     rfse – double scalar
The impulse response function standard error.
6:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 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.

  ifail = 1ifail=1
On entry,ng < 1ng<1,
orstats(1) < 3.0stats1<3.0,
orstats(2)0.0stats20.0,
orstats(2) > 1.0stats2>1.0,
orstats(3) < 1.0stats3<1.0,
orn < 1n<1.
W ifail = 2ifail=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.
W ifail = 3ifail=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.
W ifail = 4ifail=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.
W ifail = 5ifail=5
A calculated value of the squared coherency exceeds 1.01.0. For this frequency the squared coherency is reset to 1.01.0 with the consequence that the noise spectrum is zero and the contribution to the impulse response function at this frequency is zero.
  ifail = 6ifail=6
On entry,[l / 2] + 1ng[l/2]+1ng,
orl has a prime factor exceeding 1919,
orl has more than 2020 prime factors, counting repetitions.
If more than one failure of types 22, 33, 44 and 55 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

function nag_tsa_multi_noise_bivar_example
xg = [2.0349;
     0.51554;
     0.0764;
     0.01068;
     0.00093;
     0.001;
     0.00076;
     0.00037;
     0.00021];
yg = [21.97712;
     3.29761;
     0.28782;
     0.0248;
     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;
     7e-05];
xyig = [0;
     -1.1903;
     0.04087;
     0.00842;
     0.00032;
     -1e-05;
     0.00018;
     -0.00016;
     0];
stats = [30;
     0.63858;
     1.7867;
     0.33288];
l = int64(16);
n = int64(296);
[er, erlw, erup, rf, rfse, ifail] = nag_tsa_multi_noise_bivar(xg, yg, xyrg, xyig, stats, l, n)
 

er =

    0.8941
    0.3238
    0.0668
    0.0157
    0.0026
    0.0019
    0.0011
    0.0010
    0.0019


erlw =

    0.6298


erup =

    1.8291


rf =

   -0.0547
    0.0586
   -0.0322
   -0.6956
   -0.7181
   -0.8019
   -0.4303
   -0.2392
   -0.0766
    0.0657
   -0.1652
   -0.0439
   -0.0494
   -0.0384
    0.0838
   -0.0814


rfse =

    0.0863


ifail =

                    0


function g13cg_example
xg = [2.0349;
     0.51554;
     0.0764;
     0.01068;
     0.00093;
     0.001;
     0.00076;
     0.00037;
     0.00021];
yg = [21.97712;
     3.29761;
     0.28782;
     0.0248;
     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;
     7e-05];
xyig = [0;
     -1.1903;
     0.04087;
     0.00842;
     0.00032;
     -1e-05;
     0.00018;
     -0.00016;
     0];
stats = [30;
     0.63858;
     1.7867;
     0.33288];
l = int64(16);
n = int64(296);
[er, erlw, erup, rf, rfse, ifail] = g13cg(xg, yg, xyrg, xyig, stats, l, n)
 

er =

    0.8941
    0.3238
    0.0668
    0.0157
    0.0026
    0.0019
    0.0011
    0.0010
    0.0019


erlw =

    0.6298


erup =

    1.8291


rf =

   -0.0547
    0.0586
   -0.0322
   -0.6956
   -0.7181
   -0.8019
   -0.4303
   -0.2392
   -0.0766
    0.0657
   -0.1652
   -0.0439
   -0.0494
   -0.0384
    0.0838
   -0.0814


rfse =

    0.0863


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013