gives the correlation between the vectors v1 and v2.
gives the sample correlation matrix for observations in matrix m.
gives the correlation matrix for the matrices m1 and m2.
gives the correlation matrix for the multivariate symbolic distribution dist.
gives the (i,j) correlation for the multivariate symbolic distribution dist.
- Correlation[v1,v2] gives Pearson's correlation coefficient between v1 and v2.
- The lists v1 and v2 must be the same length.
- Correlation[v1,v2] is equivalent to Covariance[v1,v2]/(StandardDeviation[v1]StandardDeviation[v2]).
- For a matrix m with columns, Correlation[m] is a × matrix of the correlations between columns of m.
- For an × matrix m1 and an × matrix m2, Correlation[m1,m2] is a × matrix of the correlations between columns of m1 and columns of m2.
- Correlation works with SparseArray objects.
- Correlation[dist,i,j] gives Covariance[dist,i,j]/(σi σj), where σi is the i component of the standard deviation of dist.
- Correlation[dist] gives a correlation matrix with the (i,j) entry given by Correlation[dist,i,j].
Examplesopen allclose all
Basic Examples (3)
Exact input yields exact output:
Approximate input yields approximate output:
Correlation between vectors of complexes:
SparseArray data can be used:
Find the correlation of WeightedData:
Distributions and Processes (5)
Correlation for a continuous multivariate distribution:
Correlation for a discrete multivariate distribution:
Correlation for derived distributions:
Correlation matrix for a random process at times s and t:
Correlation matrix for TemporalData at times and :
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:
Wolfram Research (2007), Correlation, Wolfram Language function, https://reference.wolfram.com/language/ref/Correlation.html (updated 2010).
Wolfram Language. 2007. "Correlation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010. https://reference.wolfram.com/language/ref/Correlation.html.
Wolfram Language. (2007). Correlation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Correlation.html