Covariance

Covariance[v1,v2]

gives the covariance between the vectors v1 and v2.

Covariance[m]

gives the covariance matrix for the matrix m.

Covariance[m1,m2]

gives the covariance matrix for the matrices m1 and m2.

Covariance[dist]

gives the covariance matrix for the multivariate symbolic distribution dist.

Covariance[dist,i,j]

gives the (i,j) covariance for the multivariate symbolic distribution dist.

Details • Covariance[v1,v2] gives the unbiased estimate of the covariance between v1 and v2.
• The lists v1 and v2 must be the same length.
• Covariance[v1,v2] is equivalent to (v1-Mean[v1]). Conjugate[v2-Mean[v2]]/(Length[v1]-1).
• For a matrix m with columns, Covariance[m] is a × matrix of the covariances between columns of m.
• For an × matrix m1 and an × matrix m2, Covariance[m1,m2] is a × matrix of the covariances between columns of m1 and columns of m2.
• Covariance works with SparseArray objects.
• Covariance[dist,i,j] gives Expectation[(xi-μi)(xj-μj),{x1,x2,}dist], where μi is the i component of the mean of dist.
• Covariance[dist] gives a covariance matrix with the (i,j) entry given by Covariance[dist,i,j].

Examples

open all close all

Basic Examples(3)

Covariance between two vectors:

 In:= Out= Covariance matrix for a matrix:

 In:= Out//MatrixForm= Covariance matrix for two matrices:

 In:= Out//MatrixForm= Neat Examples(1)

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