GARCH Toolbox    
crosscorr

Plot or return computed sample cross-correlation function

Syntax

Arguments

Series1
Vector of observations of the first univariate time series for which crosscorr computes or plots the sample cross-correlation function (XCF). The last element of Series1 contains the most recent observation.
Series2
Vector of observations of the second univariate time series for which crosscorr computes or plots the sample XCF. The last element of Series2 contains the most recent observation.
nLags
(optional) Positive, scalar integer indicating the number of lags of the XCF to compute. If nLags = [] or is not specified, crosscorr computes the XCF at lags 0, ±1, ±2, ..., ±T, where T = min([20, min([length(Series1), length(Series2)])-1]).
nSTDs
(optional) Positive scalar indicating the number of standard deviations of the sample XCF estimation error to compute, if Series1 and Series2 are uncorrelated. If nSTDs = [] or is not specified, the default is 2 (i.e., approximate 95 percent confidence interval).

Description

crosscorr(Series1, Series2, nLags, nSTDs) computes and plots the sample cross-correlation function (XCF) between two univariate, stochastic time series. To plot the XCF sequence without the confidence bounds, set nSTDs = 0.

[XCF, Lags, Bounds] = crosscorr(Series1, Series2, nLags, nSTDs) computes and returns the XCF sequence.



XCF
Sample cross-correlation function between Series1 and Series2. XCF is a vector of length 2(nLags)+1 corresponding to lags 0, ±1, ±2, ..., ±nLags. The center element of XCF contains the 0th lag cross correlation. XCF is a row (column) vector if Series1 is a row (column) vector.
Lags
Vector of lags corresponding to XCF(-nLags, ..., +nLags).
Bounds
Two-element vector indicating the approximate upper and lower confidence bounds assuming Series1 and Series2 are completely uncorrelated.

Example

Create a random sequence of 100 Gaussian deviates, and a delayed version lagged by four samples. Compute the XCF, and then plot it to see the XCF peak at the fourth lag.

See Also
autocorr, parcorr

filter (in the online MATLAB Function Reference)


  autocorr garchar