compute sample cross-correlations of two time series - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Statistics : Statistics Package : Quantities : Statistics/CrossCorrelation

Statistics[CrossCorrelation] - compute sample cross-correlations of two time series

Calling Sequence

CrossCorrelation(X1, X2)

CrossCorrelation(X1, X2, lags)

Parameters

X1, X2

-

discrete univariate time series given as Vectors, lists, Matrices with one column, or TimeSeries objects with one dataset.

lags

-

(optional) maximal lag to return, or a range of lags to return. By default all possible lags are returned.

Description

• 

For a discrete time series X1 and X2, the CrossCorrelation command computes the cross-correlations Rk=CkC0 where Ck=t=1nkX1tX2t+k&conjugate0; for k=n+1..n1.

• 

For efficiency, all of the lags are computed at once using a numerical discrete Fourier transform.  Therefore all data provided must have type complexcons and all returned solutions are floating-point, even if the problem is specified with exact values.

• 

If the inputs are not the same length, the shorter is padded with zeros at the end.

• 

Note: CrossCorrelation makes use of DiscreteTransforms[FourierTransform] and thus will work strictly in hardware precision, that is, its accuracy is independent of the setting of Digits.

• 

For more time series related commands, see the TimeSeriesAnalysis package.

Examples

withStatistics:

CrossCorrelation1,2,1,2,1,2,1,2

0.2000000000622400.5000000000305990.5999999999867191.0.5999999999867190.5000000000305990.200000000062240

(1)

CrossCorrelation1,2,1,2,1,2,1,2,2

0.5000000000305990.5999999999867191.0.5999999999867190.500000000030599

(2)

CrossCorrelation1,2,1,2,1,2,1,2,2..2

0.5000000000305990.5999999999867191.0.5999999999867190.500000000030599

(3)

CrossCorrelation1,2,1,2,1,2,1,2,2,scaling=unbiased

1.000000000061200.7999999999822921.0.7999999999822921.00000000006120

(4)

CrossCorrelation1,2,3,4,5

0.8571428571961741.642857142967681.0.3571428571743542.3214255916459210-11

(5)

CrossCorrelation1,2,3,4,5,0

0.8571428571961741.642857142967681.0.3571428571743542.3214255916459210-11

(6)

CrossCorrelation4,5,1,2,3

2.3214255916459210-110.3571428571743541.1.642857142967680.857142857196174

(7)

CrossCorrelation4,5,0,1,2,3

2.3214255916459210-110.3571428571743541.1.642857142967680.857142857196174

(8)

The CrossCorrelation command also accepts TimeSeries objects, but the date information is ignored.

t1:=TimeSeriesAnalysis:-TimeSeries4,5,0,enddate=2012-01-01,frequency=monthly

t1:=Time seriesdata set3 rows of data:2011-11-01 - 2012-01-01

(9)

t2:=TimeSeriesAnalysis:-TimeSeries1,2,3,enddate=2015-09-30,frequency=daily

t2:=Time seriesdata set3 rows of data:2015-09-28 - 2015-09-30

(10)

CrossCorrelationt1,t2

2.3214255916459210-110.3571428571743541.1.642857142967680.857142857196174

(11)

t3:=TimeSeriesAnalysis:-TimeSeries4,5,0,1,2,3,headers=Sales,Profits,enddate=2013-05-01,frequency=weekly

t3:=Time seriesSales, Profits3 rows of data:2013-04-17 - 2013-05-01

(12)

CrossCorrelationt3..,Sales,t3..,Profits

2.3214255916459210-110.3571428571743541.1.642857142967680.857142857196174

(13)

CrossCorrelation can be used to create cross-correlograms

L:=LinearAlgebra:-RandomVector1000,datatype=float:

S:=CrossCorrelation12L101..1000+L51..9503,L1..900,150,scaling=unbiased,raw:

ColumnGraphS,offset=151,color=Gray,style=polygon

See Also

ColumnGraph, Statistics[AutoCorrelation], TimeSeriesAnalysis


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam