Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Data Manipulation > Statistics > Descriptive Statistics >
Mathematica > Mathematics and Algorithms > Statistics > Descriptive Statistics >

Covariance

Covariance[v1, v2]
gives the covariance between lists 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[v1, v2] gives the unbiased estimate of the covariance between v1 and v2.
  • The lists v1 and v2 must be the same length.
  • For a matrix m with p columns Covariance[m] is a p×p matrix of the covariances between columns of m.
  • For an n×p matrix m1 and an n×q matrix m2, Covariance[m1, m2] is a p×q matrix of the covariances between columns of m1 and columns of m2.
Covariance between two vectors:
Covariance matrix for a matrix:
Covariance matrix for two matrices:
Covariance between two vectors:
In[1]:=
Click for copyable input
Out[1]=
 
Covariance matrix for a matrix:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
 
Covariance matrix for two matrices:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
Covariances for machine-precision reals:
Use arbitrary precision:
Find the covariance between vectors of complexes:
Compute the covariance of a SparseArray:
Compute the covariance of two financial time series:
The covariance tends to be large only on the diagonal of a random matrix:
The covariance of a list with itself is the variance:
The diagonal of a covariance matrix is the variance:
A covariance matrix scaled by standard deviations is a correlation matrix:
Compute the covariance for a GCD array:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team