//----------------------------------------------------------------------------------------------- public static double GetMatricesPearsonsCorrelationCcoefficient(RealMatrix matrixOne, RealMatrix matrixTwo) { double deviationOne = Statistician.GetMatrixStandardDeviation(matrixOne); double deviationTwo = Statistician.GetMatrixStandardDeviation(matrixTwo); double result = Statistician.GetMatricesCovariance(matrixOne, matrixTwo) / (deviationOne * deviationTwo); return(result); }
//----------------------------------------------------------------------------------- //Дисперсия public static double GetDispersion(double[] array) { double meanValue = Statistician.GetMeanValue(array); double count = array.Length; double sum = 0; for (int index = 0; index < array.Length; index++) { double value = array[index]; double d = value - meanValue; sum += d * d; } double dispersion = sum / count; return(dispersion); }
//----------------------------------------------------------------------------------------------- public static double GetMatrixStandardDeviation(RealMatrix matrix) { double matrixPopulationVariance = Statistician.GetMatrixPopulationVariance(matrix); return(Math.Sqrt(matrixPopulationVariance)); }