1
function [r]=mvcorrel(x)
3
//This function computes r, the matrix of correlation of
4
//the "tableau" x (x is a numerical matrix mxn) who gives
5
//the values of n variables for m individuals: the (i,j)
7
//v(i,j)=E(xi-xibar)(xj-xjbar)/(stdi*stdj), where E is the
8
//first moment of a variable, xi is the i-th variable,
9
//xibar the mean of the xi variable and stdi the standard
10
//deviation of the i-th variable.
12
//References: Saporta, Gilbert, Probabilites, Analyse des
13
//Donnees et Statistique, Editions Technip, Paris, 1990.
15
//author: carlos klimann
19
if x==[] then s=%nan; return, end
21
if rhs <> 1 then error('mvcorrel requires only one argument.'), end
23
if lx==1 then r=zeros(lx,cx), return, end
26
std=(sum(r .^2,'r')) .^ .5
27
r=(r'*r) ./ (std'*std)