Computes the multichannel cross-correlation function of two mutually stationary multichannel time series.
Synopsis
#include<imsls.h>
float*imsls_f_multi_crosscorrelation (int n_observations_x, int n_channel_x, floatx[], intn_observations_y, int n_channel_y, floaty[], intlagmax, ..., 0)
The type double function is imsls_d_multi_crosscorrelation.
Required Arguments
intn_observations_x (Input) Number of observations in each channel of the first time series x. n_observations_x must be greater than or equal to two.
intn_channel_x (Input) Number of channels in the first time series x. n_channel_x must be greater than or equal to one.
float x[] (Input) Array of length n_observations_x by n_channel_x containing the first time series.
intn_observations_y (Input) Number of observations in each channel of the second time series y. n_observations_y must be greater than or equal to two.
intn_channel_y (Input) Number of channels in the second time series y. n_channel_y must be greater than or equal to one.
float y[] (Input) Array of length n_observations_y by n_channel_y containing the second time series.
int lagmax (Input) 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.
Return Value
Pointer to an array of length n_channel_x×n_channel_y×(2 ×lagmax+ 1) containing the cross-correlations between the channels of x and y. The m-th element of this array contains the cross-correlation between channel i of the x series and channel j of the y series at lag (k-lagmax) where
i = 1, …, n_channel_x
j = 1, …, n_channel_y
k = 0, 1, …, 2*lagmax, and
m = (n_channel_x*n_channel_y*k +(i*n_channel_x+ j))
To release this space, use imsls_free. If no solution can be computed, NULL is return.
Synopsis with Optional Arguments
#include<imsls.h>
float*imsls_f_multi_crosscorrelation(intn_observations_x, int n_channel_x, floatx[], int n_observations_y, int n_channel_y, floaty[], intlagmax,
Prints the means, variances, and cross-covariances.
3
Prints the means, variances, cross-covariances, and cross-correlations.
Default = 0.
IMSLS_INPUT_MEANS, float*x_mean_in,float*y_mean_in (Input) 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 and 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.
IMSLS_OUTPUT_MEANS, float**x_mean_out,float**y_mean_out (Output) If specified, x_mean_out is the address of a pointer to an array of length n_channel_x containing the means of the channels of x and y_mean_out is the address of a pointer to an array of length n_channel_y containing the means of the channels of y.
IMSLS_OUTPUT_MEANS_USER, floatx_mean_out[],floaty_mean_out[] (Output) If specified, x_mean_out is an array of length n_channel_x containing the means of the channels of x and y_mean_out is an array of length n_channel_y containing the means of the channels of y. See IMSLS_OUTPUT_MEANS.
IMSLS_VARIANCES, float**x_variance, float**y_variance (Output) If specified, x_variance is the address of a pointer to an array of length n_channel_x containing the variances of the channels of x and y_variance is the address of a pointer to an array of length n_channel_y containing the variances of the channels of y.
IMSLS_VARIANCES_USER, floatx_variance[], floaty_variance[] (Output) If specified, x_variance is an array of length n_channel_x containing the variances of the channels of x and y_variance is an array of length n_channel_y containing the variances of the channels of y. See IMSLS_VARIANCES.
IMSLS_CROSS_COVARIANCES, float**cross_covariances (Output) Address of a pointer to an array of length n_channel_x×n_channel_y× (2×lagmax + 1) containing the cross-covariances between the channels of x and y. The mth element of this array contains the cross-covariance between channel i of the x series and channel j of the y series at lag (k−lagmax) where
i = 1, …, n_channel_x
j = 1, …, n_channel_y
k = 0, 1, …, 2*lagmax, and
m = (n_channel_x*n_channel_y*k +(i*n_channel_x+ j)).
IMSLS_CROSS_COVARIANCES_USER, floatcross_covariances (Output) If specified, cross_covariances is an array of length n_channel_x×n_channel_y× (2×lagmax + 1) containing the cross-covariances between the channels of x and y. See IMSLS_CROSS_COVARIANCES.
IMSLS_RETURN_USER, floatcrosscorrelations[] (Output) If specified, crosscorrelations is a user-specified array of length n_channel_x×n_channel_y× (2×lagmax + 1) containing the cross-correlations between the channels of x and y. See Return Value.
Description
Function imsls_f_multi_crosscorrelation 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 for the means of the channels of Y. 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. Function imsls_f_multi_crosscorrelation is used to compute the cross-covariances and cross-correlations between X1 and Y and between X2 and Y with lags from −10 through 10.