({{, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[(Subscript[v, 1]),(Subscript[v, 2])]
gives the absolute correlation between the vectors (Subscript[v, 1]) and (Subscript[v, 2]).}, {, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[m]
gives the absolute correlation matrix for the matrix m.}, {, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[(Subscript[m, 1]),(Subscript[m, 2])]
gives the absolute correlation matrix for the matrices (Subscript[m, 1]) and (Subscript[m, 2]).}, {, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[dist]
gives the absolute correlation matrix for the multivariate symbolic distribution dist.}, {, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[dist,i,j]
gives the (i,j)(^th) absolute correlation for the multivariate symbolic distribution dist. }})

OpenersNotesSection(Spacer1)Details

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[(Subscript[v, 1]),(Subscript[v, 2])] gives the unbiased estimate of the absolute correlation between (Subscript[v, 1]) and (Subscript[v, 2]).

The lists (Subscript[v, 1]) and (Subscript[v, 2]) must be the same length.

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[(Subscript[v, 1]),(Subscript[v, 2])] is equivalent to (Subscript[v, 1]). (RefLink[Conjugate, paclet:ref/Conjugate])[(Subscript[v, 2])]/(RefLink[Length, paclet:ref/Length])[(Subscript[v, 1])].

For a matrix m with p columns, (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[m] is a p×p matrix of the absolute correlations between columns of m.

For an n×p matrix (Subscript[m, 1]) and an n×q matrix (Subscript[m, 2]), (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[(Subscript[m, 1]),(Subscript[m, 2])] is a p×q matrix of the absolute correlations between columns of (Subscript[m, 1]) and columns of (Subscript[m, 2]).

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[dist,i,j] gives (RefLink[Expectation, paclet:ref/Expectation])[(Subscript[x, i])(Subscript[x, j]),{(Subscript[x, 1]),(Subscript[x, 2]),…}∈dist].

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[dist] gives an absolute correlation matrix with the (i,j)(^th) entry given by (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation])[dist,i,j].

OpenersPrimaryExamplesSection(Spacer1)Examples  (25)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Absolute correlation between two vectors:

AbsoluteCorrelation[{a,b},{x,y}]

Absolute correlation matrix for a matrix:

AbsoluteCorrelation[{{a,b},{c,d}}]//MatrixForm

Absolute correlation matrix for two matrices:

AbsoluteCorrelation[{{a,b},{c,d}},{{x},{y}}]//MatrixForm

OpenersExampleSection1(Spacer1)Scope  (10)

OpenersExampleSubsection0(Spacer1)Data  (6)

Exact input yields exact output:

AbsoluteCorrelation[{5,3/4,1},{2,1/2,1}]

AbsoluteCorrelation[{1,π,2},{2,2,1}]//Simplify

Approximate input yields approximate output:

AbsoluteCorrelation[{1.5,3,5,10},{2,1.25,15,8}]

AbsoluteCorrelation[N[{1,2,5,6},20],N[{2,3,6,8},20]]

Absolute correlation between vectors of complexes:

AbsoluteCorrelation[{2+I,3-2I,5+4I},{I,1+2I,10-5I}]

Works with large arrays:

AbsoluteCorrelation[RandomReal[1,10^7],RandomReal[1,10^7]]

(RefLink[SparseArray, paclet:ref/SparseArray]) data can be used:

AbsoluteCorrelation[SparseArray[{{2,2}->1,{5,3}->2,{10,1}->3}]]//MatrixForm

Works with data involving quantities:

{v,w}=Quantity[{{2.5,3,5,10},{2,1.25,15,8}},"Meters"];

AbsoluteCorrelation[v,w]

OpenersExampleSubsection1(Spacer1)Distributions and Processes  (4)

Absolute correlation for a continuous multivariate distribution:

AbsoluteCorrelation[BinormalDistribution[ρ]]//MatrixForm

AbsoluteCorrelation[BinormalDistribution[ρ],2,1]

Absolute correlation for a discrete multivariate distribution:

AbsoluteCorrelation[MultivariatePoissonDistribution[μ,{2,3}]]//MatrixForm

AbsoluteCorrelation[MultivariatePoissonDistribution[μ,{2,3}],2,1]

Absolute correlation for derived distributions:

AbsoluteCorrelation[ProductDistribution[ExponentialDistribution[1],NormalDistribution[3,5]]]//MatrixForm

𝒟=CopulaDistribution[{"Frank",2}, {UniformDistribution[{0,1}], UniformDistribution[{0,1}]}];

AbsoluteCorrelation[𝒟]//MatrixForm

Data distribution:

𝒟=HistogramDistribution[RandomVariate[BinormalDistribution[.75],10^4]];

AbsoluteCorrelation[𝒟]//MatrixForm

AbsoluteCorrelation[BinormalDistribution[.75]]//MatrixForm

Absolute correlation matrix for a random process at times s and t:

Correlation[WienerProcess[][{s,t}]]//MatrixForm

OpenersExampleSection3(Spacer1)Applications  (3)

Compute the absolute correlation of two financial time series:

AbsoluteCorrelation[FinancialData["^GSPC","Open",{2009,1,1},"Value"],FinancialData["^GSPC","Close",{2009,1,1},"Value"]]

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation]) can be used to measure linear association:

data=BlockRandom[SeedRandom[1];Table[RandomVariate[BinormalDistribution[i],3000],{i,{-.99,-.75,-.25,-.5,0.,.25,.5,.75,.99}}]];

Grid[Partition[Table[ListPlot[i, PlotStyle -> Directive[PointSize[Tiny]], 
     FrameTicks -> None, Frame -> True, Axes -> None,PlotLabel -> Row[{"ρ : ", AbsoluteCorrelation[i][[1,2]]}]], {i, data}], 
   3]]

(RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation]) can only detect monotonic relationships:

uni=RandomReal[{-3,3},3000];

f[x_]:={{x,-Sqrt[Abs[x]]+RandomReal[.5]},{x,.25(x^2)+RandomReal[.5]},{x,-Sinc[x]+RandomReal[.5]},{Cos[x],Sin[x]+RandomReal[.5]}}

data=f/@uni;

Table[ListPlot[data[[All,i]],Frame->True,Axes->None,PlotLabel->Row[{"ρ : ",AbsoluteCorrelation[data[[All,i]]][[1,2]]}],PlotStyle->Directive[PointSize[Tiny]],FrameTicks->None],{i,4}]

(RefLink[HoeffdingD, paclet:ref/HoeffdingD]) can be used to detect a variety of dependence structures:

Table[HoeffdingD[data[[All,i]]][[1,2]],{i,4}]

OpenersExampleSection4(Spacer1)Properties & Relations  (8)

The absolute correlation matrix is symmetric and positive semidefinite:

corr=AbsoluteCorrelation[RandomVariate[BinormalDistribution[1/3],10^3]];

SymmetricMatrixQ[corr]

PositiveSemidefiniteMatrixQ[corr]

(RefLink[Covariance, paclet:ref/Covariance]) and (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation]) are the same for a distribution with zero mean:

𝒟=BinormalDistribution[ρ];

Mean[𝒟]

Covariance[𝒟]

AbsoluteCorrelation[𝒟]

(RefLink[Correlation, paclet:ref/Correlation]) and (RefLink[AbsoluteCorrelation, paclet:ref/AbsoluteCorrelation]) agree for zero mean and unit marginal variances:

𝒟=BinormalDistribution[ρ];

Mean[𝒟]

Variance[𝒟]

Correlation[𝒟]

AbsoluteCorrelation[𝒟]

(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]

(RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction]) for a list can be calculated using absolute correlation:

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

Calculate absolute correlation function for the data:

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

Use absolute correlation:

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

%-%%

The absolute correlation tends to be large only on the diagonal of a random matrix:

ArrayPlot[AbsoluteCorrelation[RandomReal[{-1,1},{50,50}]]]

The absolute correlation of a list with itself is proportional to the second moment:

Moment[{a,b,c},2]/AbsoluteCorrelation[{a,b,c},{a,b,c}]//Simplify[#,{a,b,c}∈Reals]&

The diagonal of an absolute correlation matrix is the second moment:

data=RandomReal[5,{20,5}];
n=Length[data];

Diagonal[AbsoluteCorrelation[data]]

Moment[data,2]

%-%%

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Compute the absolute correlation for a LCM array:

MatrixPlot[AbsoluteCorrelation[Array[LCM,{50,50}]]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Covariance, paclet:ref/Covariance])  ▪  (RefLink[Correlation, paclet:ref/Correlation])  ▪  (RefLink[AbsoluteCorrelationFunction, paclet:ref/AbsoluteCorrelationFunction])  ▪  (RefLink[Moment, paclet:ref/Moment])  ▪  (RefLink[Expectation, paclet:ref/Expectation])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Descriptive Statistics, paclet:guide/DescriptiveStatistics])}, {▪(RefLinkPlain[Statistical Moments and Generating Functions, paclet:guide/StatisticalMomentsAndGeneratingFunctions])}})}})