Contents Previous Next Subchapters Current Chapters-> prctile ftail tpdf ttail ittail cnormal inormal rand snormal seed colmad colmse colrange colmode kurtosis skewness randperm ranseed unifm0v1 unirnd normrnd exprnd gamrnd cauchyrnd gumbelrnd laplacernd lognrnd wblrnd binornd poissrnd exppdf expcdf normpdf unifpdf unifcdf wblpdf wblcdf colcor colcov colmean colstd colmax rowmax colsum rowsum colnorm rownorm median colmedian colmead colvar corr conv conv2 sum cumsum prod cumprod Parent Chapters-> Omatrix6 statistics colcov Search Tools-> contents reference index search

Covariance Between Columns Of A Matrix
 Syntax `colcov(`x`)` Syntax `colcov(`x`, `y`)` See Also cov , colcor , colstd , colmean , colmad , colmse

One Argument
The call `colcov(`x`)` returns a matrix containing the covariance of the columns of x, where x is a real or double-precision matrix. The return value has the same type as x. Each column of x corresponds to a random variable, and each row of x corresponds to a realization. The row and column dimensions of the return value are equal to the column dimension of x. If `C` is the covariance of x, ```                    N               1   ----          _          _      C   =  ----- >     (x    - x ) (x   - x )       i,j   N - 1 ----    k,i    i    k,j   j                   k = 1 ```where `N` is the number of rows in x and ```                  N      _       1  ----      x   =  --- >     x       j      N  ----   k,j                 k = 1 ```
Two Arguments
If both x and y are vectors of equal length, `colcov(`x`, `y`)` returns that covariance between the two vectors. To be specific this is the return value is equal to the return value of `colcov(`X`)` where the first column of X contains the elements of the vector x and the second column of X contains the elements of y.

Example ```      x = [{0., 2., 4.}, {0., -1., 1.}]      colcov(x) ``` returns ```      {      [ 4 , 1 ]      [ 1 , 1 ]      } ```
Mlmode
In Mlmode this function is called `cov` instead of `colcov`. If in Mlmode you enter, ```      x = [ [0 ; 2 ; 4 ], [0 ; -1 ; 1] ];      cov(x) ``` O-Matrix will reply ```      {      [ 4 , 1 ]      [ 1 , 1 ]      } ```