WOLFRAM

gives the correlation between the vectors v and w.

gives the cross-correlation matrix for the matrices a and b.

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)^(th) correlation for the multivariate symbolic distribution dist.

Details

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Correlation between two vectors:

Out[1]=1

Real values:

Out[2]=2

Correlation matrix for a matrix:

Out[1]=1

Real values:

Out[2]=2

Correlation matrix for two matrices:

Real values:

Out[2]=2

Scope  (14)Survey of the scope of standard use cases

Data  (8)

Exact input yields exact output:

Out[1]=1
Out[2]=2

Approximate input yields approximate output:

Out[1]=1
Out[2]=2

Correlation between vectors of complexes:

Out[1]=1

Works with large arrays:

Out[1]=1

A structured array can be used (see the guide):

Find the correlation for data involving quantities:

Out[2]=2

Correlation between lists of dates:

Out[1]=1
Out[2]=2
Out[3]=3

Correlation between matrices of times:

Distributions and Processes  (6)

Correlation for a continuous multivariate distribution:

Out[2]=2

Correlation for a discrete multivariate distribution:

Out[2]=2

Correlation controls the orientation and sharpness of a multivariate probability distribution:

Out[2]=2

Correlation for derived distributions:

Data distribution:

Correlation matrix for a random process at times s and t:

Correlation matrix for TemporalData at times and :

Out[1]=1

Applications  (3)Sample problems that can be solved with this function

Compute the correlation of two financial time series:

Out[3]=3

Correlation can be used to measure linear association:

Out[2]=2

Correlation can only detect monotonic relationships:

Out[4]=4

HoeffdingD can be used to detect a variety of dependence structures:

Out[5]=5

Properties & Relations  (7)Properties of the function, and connections to other functions

The correlation matrix is symmetric and positive semidefinite:

Out[2]=2
Out[3]=3

A correlation matrix is a covariance matrix scaled by standard deviations:

Out[3]=3
Out[6]=6

Correlation and AbsoluteCorrelation agree for zero mean and unit marginal variances:

Out[2]=2
Out[3]=3
Out[4]=4
Out[5]=5

SpearmanRho is Correlation applied to ranks:

Out[2]=2
Out[4]=4

CorrelationFunction for a process is the off-diagonal entry in the correlation matrix:

Out[2]=2
Out[3]=3
Out[4]=4

Correlation and Covariance are the same for standardized vectors:

Out[2]=2
Out[3]=3

The diagonal elements of a correlation matrix are equal to 1:

Out[1]=1
Wolfram Research (2007), Correlation, Wolfram Language function, https://reference.wolfram.com/language/ref/Correlation.html (updated 2024).
Wolfram Research (2007), Correlation, Wolfram Language function, https://reference.wolfram.com/language/ref/Correlation.html (updated 2024).

Text

Wolfram Research (2007), Correlation, Wolfram Language function, https://reference.wolfram.com/language/ref/Correlation.html (updated 2024).

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.

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

Wolfram Language. (2007). Correlation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Correlation.html

BibTeX

@misc{reference.wolfram_2025_correlation, author="Wolfram Research", title="{Correlation}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Correlation.html}", note=[Accessed: 29-March-2025 ]}

@misc{reference.wolfram_2025_correlation, author="Wolfram Research", title="{Correlation}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Correlation.html}", note=[Accessed: 29-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_correlation, organization={Wolfram Research}, title={Correlation}, year={2024}, url={https://reference.wolfram.com/language/ref/Correlation.html}, note=[Accessed: 29-March-2025 ]}

@online{reference.wolfram_2025_correlation, organization={Wolfram Research}, title={Correlation}, year={2024}, url={https://reference.wolfram.com/language/ref/Correlation.html}, note=[Accessed: 29-March-2025 ]}