compute sample cross-correlations of two time series
CrossCorrelation(X1, X2, lags)
discrete univariate time series given as Vectors, lists, Matrices with one column, or TimeSeries objects with one dataset.
(optional) maximal lag to return, or a range of lags to return. By default all possible lags are returned.
One of biased, unbiased, or none. Default is none. scaling=biased computes Rk=Ckn. scaling=unbiased scales each Ck by 1n−k.
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.
For a discrete time series X1 and X2, the CrossCorrelation command computes the cross-correlations Rk=CkC0 where Ck=∑t=1n−k⁡X1t⁢X2t+k&conjugate0; for k=−n+1..n−1.
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.
The CrossCorrelation command also accepts TimeSeries objects, but the date information is ignored.
t1 ≔ TimeSeriesAnalysis:-TimeSeries⁡4,5,0,enddate=2012-01-01,frequency=monthly
t1≔Time seriesdata set3 rows of data:2011-11-01 - 2012-01-01
t2 ≔ TimeSeriesAnalysis:-TimeSeries⁡1,2,3,enddate=2015-09-30,frequency=daily
t2≔Time seriesdata set3 rows of data:2015-09-28 - 2015-09-30
t3 ≔ TimeSeriesAnalysis:-TimeSeries⁡4,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
CrossCorrelation can be used to create cross-correlograms
L ≔ LinearAlgebra:-RandomVector⁡1000,datatype=float:
S ≔ CrossCorrelation⁡1⁢2⁢L101..1000+L51..9503,L1..900,150,scaling=unbiased,raw:
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.
Download Help Document
What kind of issue would you like to report? (Optional)