CrossCorrelation - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Statistics

  

CrossCorrelation

  

compute sample cross-correlations of two time series

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

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.

Options

• 

scaling

  

One of biased, unbiased, or none.  Default is none. scaling=biased computes Rk=Ckn. scaling=unbiased scales each Ck by 1nk.

• 

raw

  

If this option is given, the output is not normalized so that the middle entry (corresponding to R0) is 1 when scaling=unbiased or scaling=none.

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.32142559164592×10−11

(5)

CrossCorrelation1,2,3,4,5,0

0.8571428571961741.642857142967681.0.3571428571743542.32142559164592×10−11

(6)

CrossCorrelation4,5,1,2,3

2.32142559164592×10−110.3571428571743541.1.642857142967680.857142857196174

(7)

CrossCorrelation4,5,0,1,2,3

2.32142559164592×10−110.3571428571743541.1.642857142967680.857142857196174

(8)

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

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

t1Time seriesdata set3 rows of data:2011-11-01 - 2012-01-01

(9)

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

t2Time seriesdata set3 rows of data:2015-09-28 - 2015-09-30

(10)

CrossCorrelationt1,t2

2.32142559164592×10−110.3571428571743541.1.642857142967680.857142857196174

(11)

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

t3Time seriesSales, Profits3 rows of data:2013-04-17 - 2013-05-01

(12)

CrossCorrelationt3..,Sales,t3..,Profits

2.32142559164592×10−110.3571428571743541.1.642857142967680.857142857196174

(13)

CrossCorrelation can be used to create cross-correlograms

LLinearAlgebra:-RandomVector1000,datatype=float:

SCrossCorrelation132L101..1000+L51..950,L1..900,150,scaling=unbiased,raw:

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

Compatibility

• 

The Statistics[CrossCorrelation] command was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

• 

The Statistics[CrossCorrelation] command was updated in Maple 2015.

• 

The X1 parameter was updated in Maple 2015.

See Also

ColumnGraph

Statistics[AutoCorrelation]

TimeSeriesAnalysis