IMSL Statistics Reference Guide > Time Series and Forecasting > MULTI_CROSS Function (PV-WAVE Advantage)
  

MULTI_CROSS Function (PV-WAVE Advantage)
Computes the multichannel cross-correlation function of two mutually stationary multichannel time series.
Usage
result = MULTI_CROSS (x, y, lagmax)
Input Parameters
x—2D array of size n_observations_x by n_channel_x containing the first time series, where n_observations_x is the number of observations in each channel of the first time series x and n_channel_x is the number of channels in the first time series x (n_observation_x 2, n_channel_x 1).
y—2D array of size n_observations_y by n_channel_y containing the second time series, where n_observations_y is the number of observations in each channel of the first time series y and n_channel_y is the number of channels in the first time series y (n_observation_y 2, n_channel_y 1).
lagmax—Maximum lag of cross-covariances and cross-correlations to be computed. lagmax must be greater than or equal to one and less than the minimum of n_observations_x and n_observations_y.
Returned Value
result—3D array of size (n_channel_x by n_channel_y by (2 * lagmax + 1)) containing the cross-correlations between the channels of x and y.
Input Keywords
Double—If present and nonzero, double precision is used.
X_mean_in—If specified, X_mean_in is an array of length n_channel_x containing the user input of the estimate of the means of the channels of x.
Y_mean_in—If specified, Y_mean_in is an array of length n_channel_y containing the user input of the estimate of the means of the channels of y.
Output Keywords
X_variance—If specified, X_variance is an array of length n_channel_x containing the variances of the channels of x.
Y_variance—If specified, Y_variance is an array of length n_channel_y containing the variances of the channels of y.
Cross_covar—A 3D array of length (n_channel_x by n_channel_y by (2 * lagmax + 1)) containing the cross-covariances between the channels of x and y.
X_mean_out—If specified, X_mean_out is an array of length n_channel_x containing the means of the channels of x.
Y_mean_out—If specified, Y_mean_out is an array of length n_channel_y containing the means of the channels of y.
Discussion
MULTI_CROSS estimates the multichannel cross-correlation function of two mutually stationary multichannel time series. Define the multichannel time series X by:
X = (X1, X2, ..., Xp)
where:
Xj = (X1j, X2j, ..., Xnj)T, j = 1, 2, ..., p
with n = n_observations_x and p = n_channel_x. Similarly, define the multichannel time series Y by:
Y = (Y1, Y2, ..., Yq)
where:
Yj = (Y1j, Y2j, ..., Ymj)T, j = 1, 2, ..., q
with m = n_observations_y and q = n_channel_y. The columns of X and Y correspond to individual channels of multichannel time series and may be examined from a univariate perspective. The rows of X and Y correspond to observations of p-variate and q-variate time series, respectively, and may be examined from a multivariate perspective. Note that an alternative characterization of a multivariate time series X considers the columns to be observations of the multivariate time series while the rows contain univariate time series. For example, see Priestley (1981, page 692) and Fuller (1976, page 14).
Let:
be the row vector containing the means of the channels of X. In particular:
where for j = 1, 2, …, p:
Let:
be similarly defined. The cross-covariance of lag k between channel i of X and channel j of Y is estimated by:
where i = 1, …, p, j = 1, …, q, and K = lagmax. The summation on t extends over all possible cross-products with N equal to the number of cross-products in the sum.
Let:
be the row vector consisting of the estimated variances of the channels of X. In particular:
where:
Let:
be similarly defined. The cross-correlation of lag k between channel i of X and channel j of Y is estimated by:
Example
Consider the Wolfer Sunspot Data (Y) (Box and Jenkins 1976, page 530) along with data on northern light activity (X1) and earthquake activity (X2) (Robinson 1967, page 204) to be a three-channel time series. MULTI_CROSS is used to compute the cross-covariances and cross-correlations between X1 and Y and between X2 and Y with lags from –lagmax = –10 through lag lagmax = 10.
; Set up the sample data
data = STATDATA(8)
n_observation_x = 100
n_observation_y = 100
n_channel_x = 2
n_channel_y = 1
lagmax = 10
 
x = FLTARR(n_observation_x , n_channel_x)
y = FLTARR(n_observation_y , n_channel_y)
 
x(*,0) = data(*,2)
x(*,1) = data(*,3)
y(*,0) = data(*,1)
 
; Call the MULTI_CROSS routine
cc = MULTI_CROSS( $
                  x, $
                  y, $
                  lagmax , $
                  X_mean_out=x_mean_out, $
                  Y_mean_out=y_mean_out, $
                  X_variance=x_variance, $
                  Y_variance=y_variance, $
                  Cross_covariances=cross_covar)
 
; Print the output
PRINT,""
PRINT,"     OUTPUT"
PRINT,"-----------------"
PRINT,""
PRINT,"Channel Means of X:"
PRINT,'         1            2'
PRINT, x_mean_out
PRINT,""
PRINT,"Channel Variances of X:"
PRINT,'         1            2'
PRINT, x_variance
PRINT,""
PRINT,"Channel Means of Y:"
PRINT, y_mean_out
PRINT,""
PRINT,"Channel Variances of Y:"
PRINT, y_variance
PRINT,""
PRINT,"Multichannel Cross-Covariance Between X and Y"
PRINT,"---------------------------------------------"
PRINT,""
temp_cross = [REFORM(cross_covar(0,0,*),(2*lagmax+1)),$
              REFORM(cross_covar(1,0,*),(2*lagmax+1))]
FOR i=0L, 2*lagmax DO BEGIN $
  z = i*2 & $
  PRINT,"  Lag K = "+STRTRIM((i-lagmax),2) & $
  PRINT,'1',temp_cross(z),Format="((A),(F12.2))"  & $
  PRINT,'2',temp_cross(z+1),Format="((A),(F12.2))"  & $
ENDFOR
PRINT,""
PRINT,"Multichannel Cross-Correlation Between X and Y"
PRINT,"---------------------------------------------"
PRINT,""
temp_cross = [REFORM(cc(0,0,*),(2*lagmax+1)),$
                  REFORM(cc(1,0,*),(2*lagmax+1))]
 
FOR i=0L, 2*lagmax DO BEGIN $
  z = i*2 & $
  PRINT,"  Lag K = ",STRTRIM((i-lagmax),2) & $
  PRINT,'1',temp_cross(z),Format="((A),(F15.5))"  & $
  PRINT,'2',temp_cross(z+1),Format="((A),(F15.5))"  & $
ENDFOR
Output
OUTPUT
-----------------
 
Channel Means of X:
         1            2
      63.4300      97.9700
 
Channel Variances of X:
         1            2
      2643.69      1978.43
 
Channel Means of Y:
      46.9400
 
Channel Variances of Y:
      1383.76
 
Multichannel Cross-Covariance Between X and Y
---------------------------------------------
 
  Lag K = -10
1      -20.51
2       70.71
  Lag K = -9
1       65.02
2       38.14
  Lag K = -8
1      216.64
2      135.58
  Lag K = -7
1      246.79
2      100.36
  Lag K = -6
1      142.13
2       44.97
  Lag K = -5
1       50.70
2      -11.81
  Lag K = -4
1       72.68
2       32.69
  Lag K = -3
1      217.85
2      -40.12
  Lag K = -2
1      355.82
2     -152.65
  Lag K = -1
1      579.65
2     -212.95
  Lag K = 0
1      821.63
2     -104.75
  Lag K = 1
1      810.13
2       55.16
  Lag K = 2
1      628.39
2       84.78
  Lag K = 3
1      438.27
2       75.96
  Lag K = 4
1      238.79
2      200.38
  Lag K = 5
1      143.62
2      282.99
  Lag K = 6
1      252.97
2      234.39
  Lag K = 7
1      479.47
2      223.03
  Lag K = 8
1      724.91
2      124.46
  Lag K = 9
1      924.97
2      -79.52
  Lag K = 10
1      922.76
2     -279.29
 
Multichannel Cross-Correlation Between X and Y
---------------------------------------------
 
  Lag K = -10
1       -0.01072
2        0.04274
  Lag K = -9
1        0.03400
2        0.02305
  Lag K = -8
1        0.11327
2        0.08194
  Lag K = -7
1        0.12903
2        0.06066
  Lag K = -6
1        0.07431
2        0.02718
  Lag K = -5
1        0.02651
2       -0.00714
  Lag K = -4
1        0.03800
2        0.01976
  Lag K = -3
1        0.11390
2       -0.02425
  Lag K = -2
1        0.18604
2       -0.09226
  Lag K = -1
1        0.30306
2       -0.12870
  Lag K = 0
1        0.42958
2       -0.06331
  Lag K = 1
1        0.42357
2        0.03334
  Lag K = 2
1        0.32854
2        0.05124
  Lag K = 3
1        0.22914
2        0.04591
  Lag K = 4
1        0.12485
2        0.12111
  Lag K = 5
1        0.07509
2        0.17103
  Lag K = 6
1        0.13226
2        0.14166
  Lag K = 7
1        0.25068
2        0.13480
  Lag K = 8
1        0.37901
2        0.07522
  Lag K = 9
1        0.48361
2       -0.04806
  Lag K = 10
1        0.48245
2       -0.16880

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.