Contents Previous Next Subchapters

Correlation Coefficients Between Columns Of A Matrix
Syntax colcor(x)
Syntax colcor(xy)
See Also corrcoef , colcov , colstd , colmean , colmad , colmse

Description
The call colcor(x) returns a matrix containing the correlation 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 colcov(x) , the (ij)th element of the return value is C(i,j) / sqrt(C(i,iC(j,j)).

Two Arguments
If both x and y are vectors of equal length, colcor(xy) returns that correlation between the two vectors. To be specific this is the return value is equal to the return value of colcor(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.}]
     colcor(x)
returns
     {
     [ 1 , 0.5 ]
     [ 0.5 , 1 ]
     }

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