Correlation

Correlation[v1,v2]

gives the correlation between the vectors v1 and v2.

Correlation[m]

gives the correlation matrix for the matrix m.

Correlation[m1,m2]

gives the correlation matrix for the matrices m1 and m2.

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[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].

Examples

open all close all

Basic Examples(3)

Correlation between two vectors:

 In:= Out= Real values:

 In:= Out= Correlation matrix for a matrix:

 In:= Out= Real values:

 In:= Out= Correlation matrix for two matrices:

 In:= Out//MatrixForm= Real values:

 In:= Out= Properties & Relations(7)

Introduced in 2007
(6.0)
|
Updated in 2010
(8.0)