XCOV

Purpose:

Calculates the cross-covariance using direct convolution.

Syntax:

XCOV(series1, series2, norm)

series1

-

A series or array.

series2

-

A series or array.

norm

-

Optional. An integer, the normalization method:

0:

None (default)

1:

Unity (-1 to 1)

2:

Biased

3:

Unbiased

Returns:

A series.

Example:

W1: gsin(1000, .001, 4)

W2: gsin(1000, .001, 4)

W3: xcov(W1, W2)

 

Performs the cross-covariance of two sine waves. The peaks of the result indicate the two series are very similar at the time intervals where the peaks occur.

Example:

W1: gsin(1000, .001, 4)

W2: gnorm(1000, .001)

W3: xcov(W1, W1, 1)

W4: xcov(W1, W2, 1)

 

image\xcovpic.gif

 

W3 displays the cross-covariance of a sine wave normalized to -1 and 1. W4 shows the cross-covariance between a sine wave and random noise. The normalized maximum of W3 is 1.0, indicating perfect covariance at time t = 0. Although the series of W4 displays some peaks, the normalized maximum is roughly 0.04 indicating little covariance between W1 and W2. For a graphical representation, OVERPLOT W4 in W3.

Remarks:

The cross-covariance for a random process is defined as:

 

image\xcov01.gif

 

where E is the expected value operator, x[n] and y[n] are a stationary random processes, μx and μy are the mean values and * indicates complex conjugate. In practice, the cross-covariance is estimated because only a finite sample of an infinite duration random process is available. The estimate of the cross-covariance function for series of length N is defined as:

 

image\xcov02.gif

 

where:

 

image\xcov03.gif

 

XCOV performs cross-covariance by computing the direct convolution the input series.

 

The output length L is:

 

L = length(series1) + length(series2) - 1

 

The zeroth lag component is the mid point of the series.

 

The BIASED normalization divides the result by N, the maximum length of the input series.

 

image\xcov04.gif

 

The UNBIASED normalization divides the result by

 

N - abs(N - i - 1) + 1

 

where i is the index of the result with a start value of 1. For a 0 start index, the unbiased estimate becomes:

 

image\xcov05.gif

 

The cross-covariance is used to determine how similar two series are to each other.

 

See FXCOV for the frequency domain implementation.

See Also:

ACORR

ACOV

CONV

COVM

FACORR

FACOV

FCONV

FXCORR

FXCOV

XCORR