metreex-analysis.js
/**
 *
 * @param data Should be passed as an m x n array (of arrays), with columns being variables and rows being the related observations.
 *              First index should be observations (sentences). Second index should be variables (metrics).
 */
@param data Should be passed as an m x n array (of arrays), with columns being variables and rows being the related observations.
First index should be observations (sentences). Second index should be variables (metrics).
@param data Should be passed as an m x n array ( of arrays ) with columns being variables and rows being the related observations . First index should be observations ( sentences ) . Second index should be variables ( metrics ) .
function computeCovariance(data){
    var dataMatrix = math.matrix(data),
        observations = data.length,
        a = math.multiply(math.ones(observations, observations), 1/observations),
        b = math.multiply(a, dataMatrix),
        deviationMatrix = math.subtract(dataMatrix, b);
    return math.multiply(1/observations,math.transpose(deviationMatrix),deviationMatrix)._data; 
}
function computeCovariance ( data ) { var dataMatrix = math . matrix ( data ) , observations = data . length , a = math . multiply ( math . ones ( observations , observations ) , 1 / observations ) , b = math . multiply ( a , dataMatrix ) , deviationMatrix = math . subtract ( dataMatrix , b ) ; return math . multiply ( 1 / observations , math . transpose ( deviationMatrix ) , deviationMatrix ) . _data ; }
@param data Should be passed as an m x n array (of arrays), with columns being variables and rows being the related observations.
@param data Should be passed as an m x n array ( of arrays ) with columns being variables and rows being the related observations .
//covariance matrix