({{, (RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[data,hspec] 
estimates the absolute correlation function at lags hspec from data.}, {, (RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[proc,hspec] 
represents the absolute correlation function at lags hspec for the random process proc. }, {, (RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[proc,s,t] 
represents the absolute correlation function at times s and t for the random process proc. }})

OpenersNotesSection(Spacer1)Details

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction]) is also known as the autocorrelation function.

The following specifications can be given for hspec:

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[{(Subscript[x, 1]),…,(Subscript[x, n])},h] is equivalent to (1/n)(∑_(i==1)^(n-h))(Subscript[x, i]) (Subscript[x, h+i]).

When data is (RefLink[TemporalData, paclet:ref/TemporalData]) containing an ensemble of paths, the output represents the average across all paths.

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction]) for a process proc with value x[t] at time t is given by:

The symbol ⊗ represents (RefLink[KroneckerProduct, paclet:ref/KroneckerProduct]).

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[proc,h] is defined only if proc is a weakly stationary process and is equivalent to (RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])[proc,h,0].

The process proc can be any random process such as (RefLink[ARMAProcess, paclet:ref/ARMAProcess]) and (RefLink[WienerProcess, paclet:ref/WienerProcess]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (33)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Estimate the absolute correlation function at lag 2:

AbsoluteCorrelationFunction[{2,3,4,3},2]

Sample the absolute correlation function for a random sample from an autoregressive time series:

data=RandomFunction[ARProcess[{.2,.3,.4},1],{1,10^4}];

ListPlot[AbsoluteCorrelationFunction[data,{30}],Filling->Axis,PlotRange->All]

The absolute correlation function for a discrete-time process:

AbsoluteCorrelationFunction[BinomialProcess[p],s,t]

DiscretePlot3D[Evaluate[%/.{p->2/3}],{s,0,10},{t,0,10},ExtentSize->1/2,ColorFunction->"Rainbow"]

The absolute correlation function for a continuous-time process:

AbsoluteCorrelationFunction[WienerProcess[μ,σ],s,t]

Plot3D[Evaluate[%/.{μ->1,σ->2}],{s,0,10},{t,0,10},ColorFunction->"Rainbow"]

OpenersExampleSection1(Spacer1)Scope  (13)

OpenersExampleSubsection0(Spacer1)Empirical Estimates  (7)

Estimate the absolute correlation function for some data at lag 5:

AbsoluteCorrelationFunction[Range[10],5]

Obtain empirical estimates of the correlation function up to lag 9:

AbsoluteCorrelationFunction[Range[10],{9}]

Compute the absolute correlation function for lags 1 to 9 in steps of 2:

AbsoluteCorrelationFunction[Range[10],{1,9,2}]

Compute the absolute correlation function for a time series:

ts=TimeSeries[];

The absolute correlation function of a time series for multiple lags is given as a time series:

abscorr=AbsoluteCorrelationFunction[ts,{100}]

ListPlot[abscorr,Filling->Axis]

Estimate the absolute correlation function for an ensemble of paths:

data=RandomFunction[ARProcess[{.8},1],{0,500},10]

abscorr=AbsoluteCorrelationFunction[data,{12}];

ListPlot[abscorr,Filling->0]

Compare empirical and theoretical absolute correlation functions:

proc=MAProcess[{.4,.3,.5,.6,.3},1.];

data=RandomFunction[proc,{0,100}];

ListPlot[AbsoluteCorrelationFunction[#,{10}]&/@{proc,data},Filling->{1->{2}},PlotStyle->PointSize[Medium],PlotLegends->{"process absolute correlation", "sample absolute correlation"}]

Plot the absolute cross-correlation for vector data:

proc=ARProcess[{{{.3,.1},{.6,.3}}},{{1,.3},{.3,.6}}];
data=RandomFunction[proc,{100}];
cov=AbsoluteCorrelationFunction[data,{-6,6}];

Table[ListPlot[cov["Values"][[All,i,j]],Filling->0,PlotLabel->{i,j}],{i,1,2},{j,1,2}]

OpenersExampleSubsection1(Spacer1)Random Processeses  (6)

The absolute correlation function for a weakly stationary discrete-time process:

AbsoluteCorrelationFunction[ARProcess[{a},(σ^2)],s,t]

DiscretePlot3D[Evaluate[%/.{a->2/3,σ->1}],{s,0,10},{t,0,10},ExtentSize->1/2,ColorFunction->"Rainbow"]

The absolute correlation function only depends on the antidiagonal h==t-s:

AbsoluteCorrelationFunction[ARProcess[{a},(σ^2)],h]

DiscretePlot[Evaluate[%/.{a->2/3,σ->1}],{h,0,10},ExtentSize->1/2,ColorFunction->"Rainbow",AxesLabel->{h,None}]

The absolute correlation function for a weakly stationary continuous-time process:

AbsoluteCorrelationFunction[OrnsteinUhlenbeckProcess[μ,σ,θ],s,t]

Plot3D[Evaluate[%/.{μ->1,σ->2,θ->1/3}],{s,0,10},{t,0,10},ColorFunction->"Rainbow"]

The absolute correlation function only depends on the antidiagonal h==t-s:

AbsoluteCorrelationFunction[OrnsteinUhlenbeckProcess[μ,σ,θ],h]

Plot[Evaluate[%/.{μ->1,σ->2,θ->1/3}],{h,0,10},ColorFunction->"Rainbow",Filling->Axis,AxesLabel->{h,None}]

The absolute correlation function for a non-weakly stationary discrete-time process:

AbsoluteCorrelationFunction[BinomialProcess[p],s,t]

DiscretePlot3D[Evaluate[%/.p->1/3],{s,0,10},{t,0,10},ExtentSize->1/2,ColorFunction->"Rainbow"]

The absolute correlation function depends on both time arguments:

antidiagonals=AbsoluteCorrelationFunction[BinomialProcess[1/3],t,t+h]

DiscretePlot[Evaluate@Table[antidiagonals,{t,1,4}],{h,0,6},ExtentSize->1/2,AxesLabel->{h,None},PlotLegends->(Row[{"t =",#}]&/@Range[1,4])]

The absolute correlation function for a non-weakly stationary continuous-time process:

AbsoluteCorrelationFunction[PoissonProcess[μ],s,t]

Plot3D[Evaluate[%/.μ->3],{s,0,10},{t,0,10},ColorFunction->"Rainbow"]

The absolute correlation function depends on both time arguments:

antidiagonals=AbsoluteCorrelationFunction[PoissonProcess[3],t,t+h]

Plot[Evaluate@Table[antidiagonals,{t,1,4}],{h,0,6},AxesLabel->{h,None},PlotLegends->(Row[{"t =",#}]&/@Range[1,4])]

The correlation function for some time series processes:

proc1=ARProcess[{.8},1];
proc2=MAProcess[{-.4,-.7,.6,-1},1];
proc3=SARMAProcess[{},{},{3,{.6},{.1}},1];
proc4=FARIMAProcess[{},1/3,{},1];

DiscretePlot[AbsoluteCorrelationFunction[#,h],{h,0,15},ExtentSize->1/2,PlotRange->All,PlotLabel->Head[#]]&/@{proc1,proc2,proc3,proc4}

Absolute cross-correlation plots for a vector (RefLink[ARProcess, paclet:ref/ARProcess]):

proc=ARProcess[{{{.3,.1},{.6,.3}}},{{1,.3},{.3,.6}}];
cov=AbsoluteCorrelationFunction[proc,h];

Table[DiscretePlot[cov[[i,j]],{h,-6,6},ExtentSize->1/2,PlotLabel->{i,j}],{i,1,2},{j,1,2}]

OpenersExampleSection3(Spacer1)Applications  (2)

Determine whether the following data is best modeled with an (RefLink[MAProcess, paclet:ref/MAProcess]) or an (RefLink[ARProcess, paclet:ref/ARProcess]):

ListLinePlot[data=TimeSeries[]]

It is difficult to determine the underlying process from sample paths:

candidates={MAProcess[{.5,.4},1],ARProcess[{.5,.4},1]};

SeedRandom[2];
ListLinePlot[RandomFunction[#,{0,100}]]&/@candidates

The absolute correlation function of the data decays slowly:

ListPlot[AbsoluteCorrelationFunction[data,{10}],Filling->0]

(RefLink[ARProcess, paclet:ref/ARProcess]) is clearly a better candidate model than (RefLink[MAProcess, paclet:ref/MAProcess]):

ListPlot[AbsoluteCorrelationFunction[#,{10}],PlotLabel->Head[#],Filling->0]&/@candidates

Use the absolute correlation function to determine if a process is mean ergodic:

proc=OrnsteinUhlenbeckProcess[0,σ,θ];

The process is weakly stationary:

WeakStationarity[proc]

Calculate the absolute correlation function:

abscorr[h_]=AbsoluteCorrelationFunction[proc,h]

Find the value of the strip integral:

int[t_]=1/(2*t)Integrate[(1-Abs[u]/(2*t))abscorr[u],{u,-2*t,2*t},Assumptions->t>0]

Check if the limit of the integral is 0 to conclude mean ergodicity:

Limit[int[t],t->∞,Assumptions->σ>0&&θ>0]

OpenersExampleSection4(Spacer1)Properties & Relations  (13)

Sample absolute correlation function is a biased estimator for the process absolute correlation function:

proc=ARMAProcess[1,{5/6,-1/6},{2/3},1];
paths=RandomFunction[proc,{0,n=10},10^4];

Calculate the sample absolute correlation function:

AbsoluteCorrelationFunction[paths,{10}]

sacf=TimeSeriesMapThread[(#2(n+1)/(n+1-#1))&,%]

Absolute correlation function for the process:

acf=AbsoluteCorrelationFunction[proc,{10}]

Plot both functions:

ListPlot[{sacf,acf},Filling->0,PlotLegends->{"sample absolute correlation","process absolute correlation"}]

Absolute correlation function for a list can be calculated using (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation]):

data=Range[10];
n=Length[data];

Calculate absolute correlation function for the data:

AbsoluteCorrelationFunction[data,{n-1}]/(Range[n,1,-1]/n)

Use absolute correlation:

Table[ AbsoluteCorrelation[Drop[data,i],Drop[RotateRight[data,i],i]],{i,0,n-1}]

%-%%

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction]) is the off-diagonal entry in the absolute correlation matrix:

𝒫=WienerProcess[μ,σ];

AbsoluteCorrelation[𝒫[{s,t}],1,2]

AbsoluteCorrelationFunction[𝒫,s,t]

Simplify[%%-%,0<s<t]

Sample absolute correlation function at lag 0 estimates the second (RefLink[Moment, paclet:ref/Moment]):

data=Range[10];
AbsoluteCorrelationFunction[data,0]

Moment[data,2]

%-%%

Sample absolute correlation function is related to (RefLink[CovarianceFunction, paclet:ref/CovarianceFunction]):

data=Range[10];
n=Length[data];

AbsoluteCorrelationFunction[data-Mean[data],{n-1}]

CovarianceFunction[data,{n-1}]

%-%%

Sample absolute correlation function is related to (RefLink[CorrelationFunction, paclet:ref/CorrelationFunction]):

data=Range[10];
n=Length[data];

AbsoluteCorrelationFunction[data-Mean[data],{n-1}]

Scale by the first element:

%/First[%]

Compare to the sample correlation function:

CorrelationFunction[data,{n-1}]

%-%%

Use (RefLink[Expectation, paclet:ref/Expectation]) to calculate the absolute correlation function:

𝒫=WienerProcess[μ,σ];

Expectation[x[s] x[t],x\[Distributed]𝒫,Assumptions->s>0&&t>0]

AbsoluteCorrelationFunction[𝒫,s,t]

Simplify[%-%%,s<t]

The absolute correlation function r(t,t) is related to the (RefLink[Moment, paclet:ref/Moment]) function:

𝒫=GeometricBrownianMotionProcess[μ,σ,θ];

AbsoluteCorrelationFunction[𝒫,t,t]

Verify equality r(t,t)==(Subscript[μ, 2])(t), where (Subscript[μ, k])(t) is the k(^th) moment function:

Moment[𝒫[t],2]

%-%%//Simplify

The absolute correlation function r(s,t) is related to the (RefLink[CovarianceFunction, paclet:ref/CovarianceFunction]) c(s,t):

𝒫=WienerProcess[μ,σ];

CovarianceFunction[𝒫,s,t]

Verify equality r(s,t)==c(s,t)-μ(s) μ(t), where μ(t) is the mean function:

AbsoluteCorrelationFunction[𝒫,s,t]-Mean[𝒫[s]] Mean[𝒫[t]]

%-%%

The absolute correlation function equals (RefLink[CovarianceFunction, paclet:ref/CovarianceFunction]) when the mean of the process is zero:

AbsoluteCorrelationFunction[WienerProcess[],s,t]

CovarianceFunction[WienerProcess[],s,t]

%-%%

The absolute correlation function is invariant for (RefLink[ToInvertibleTimeSeries, paclet:ref/ToInvertibleTimeSeries]):

proc=MAProcess[{2,4},1];

TimeSeriesInvertibility[proc]

iproc=ToInvertibleTimeSeries@proc

AbsoluteCorrelationFunction[#,s,t]&/@{proc,iproc}

The absolute correlation function is not invariant to centralizing:

data=EventSeries[];

The data has nonzero mean:

Mean[data]

Centralize data:

newdata=Standardize[data,Mean,1&];

Compare absolute correlation functions:

ListPlot[AbsoluteCorrelationFunction[#,{20}],Filling->0]&/@{data,newdata}

(RefLink[PowerSpectralDensity, paclet:ref/PowerSpectralDensity]) is a transform of the absolute correlation function for mean zero processes:

proc=ARProcess[{a},(σ^2)];
cf=AbsoluteCorrelationFunction[proc,h]

Use (RefLink[FourierSequenceTransform, paclet:ref/FourierSequenceTransform]) with appropriate parameters:

ft=FourierSequenceTransform[cf,h,z]

Compare to the power spectrum:

PowerSpectralDensity[proc,z]

FullSimplify[%-ft]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction]) output may contain (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]):

AbsoluteCorrelationFunction[ARProcess[{a,b},(σ^2)],t] //Simplify[#,t>0]&

Use (RefLink[FunctionExpand, paclet:ref/FunctionExpand]) to recover explicit powers:

%//FunctionExpand

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CovarianceFunction, paclet:ref/CovarianceFunction])  ▪  (RefLink[CorrelationFunction, paclet:ref/CorrelationFunction])  ▪  (RefLink[PartialCorrelationFunction, paclet:ref/PartialCorrelationFunction])  ▪  (RefLink[Covariance, paclet:ref/Covariance])  ▪  (RefLink[Correlation, paclet:ref/Correlation])  ▪  (RefLink[WeakStationarity, paclet:ref/WeakStationarity])  ▪  (RefLink[PowerSpectralDensity, paclet:ref/PowerSpectralDensity])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Time Series Processes, paclet:guide/TimeSeriesProcesses])}, {▪(RefLinkPlain[Random Processes, paclet:guide/RandomProcesses])}, {▪(RefLinkPlain[Stochastic Differential Equation Processes, paclet:guide/StochasticDifferentialEquationProcesses])}})}})