Correlation

Correlation[v,w]
gives the correlation between the vectors v and w.
Correlation[a,b]
gives the cross-correlation matrix for the matrices a and b.
Correlation[a]
gives the auto-correlation matrix for observations in matrix a.
Correlation[dist]
gives the correlation matrix for the multivariate symbolic distribution dist.
Correlation[dist,i,j]
gives the (i,j) correlation for the multivariate symbolic distribution dist.
Details


- Correlation is typically used to measure covariation, i.e. whether one variable tends to vary similarly to another.
- For vectors, the correlation estimate Correlation[v,w] is given by
with σv w=Covariance[v,w] and σv=StandardDeviation[v].
- The correlation
is a normalized covariance with
.
- For matrices
and
with dimensions
and
and columns indexed as
and
, respectively, Correlation[a,b] is a
matrix with elements given by
:
- where Σa b=Covariance[a,b] and σa=StandardDeviation[a] etc.
- For a matrix a with
columns, Correlation[a] is a
matrix given by Correlation[a, a].
- Correlation works with any vector that is VectorQ or matrix that is MatrixQ.
- Correlation[dist,i,j] gives Covariance[dist,i,j]/(σi σj), where σi=StandardDeviation[dist]〚i〛.
- Correlation[dist] gives a correlation matrix with the (i,j)
entry given by Correlation[dist,i,j].



Examples
open allclose allBasic Examples (3)
Scope (14)
Data (8)
Exact input yields exact output:
Approximate input yields approximate output:
Correlation between vectors of complexes:
A structured array can be used (see the guide):
Find the correlation for data involving quantities:
Distributions and Processes (6)
Correlation for a continuous multivariate distribution:
Correlation for a discrete multivariate distribution:
Correlation controls the orientation and sharpness of a multivariate probability distribution:
Correlation for derived distributions:
Correlation matrix for a random process at times s and t:
Correlation matrix for TemporalData at times and
:
Applications (3)
Compute the correlation of two financial time series:
Correlation can be used to measure linear association:
Correlation can only detect monotonic relationships:
HoeffdingD can be used to detect a variety of dependence structures:
Properties & Relations (7)
The correlation matrix is symmetric and positive semidefinite:
A correlation matrix is a covariance matrix scaled by standard deviations:
Correlation and AbsoluteCorrelation agree for zero mean and unit marginal variances:
SpearmanRho is Correlation applied to ranks:
CorrelationFunction for a process is the off-diagonal entry in the correlation matrix:
Correlation and Covariance are the same for standardized vectors:
The diagonal elements of a correlation matrix are equal to 1:
Text
Wolfram Research (2007), Correlation, Wolfram Language function, https://reference.wolfram.com/language/ref/Correlation.html (updated 2024).
CMS
Wolfram Language. 2007. "Correlation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Correlation.html.
APA
Wolfram Language. (2007). Correlation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Correlation.html