コード例 #1
0
        //-----------------------------------------------------------------------------------------------
        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);
        }
コード例 #2
0
        //-----------------------------------------------------------------------------------
        //Дисперсия
        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);
        }
コード例 #3
0
        //-----------------------------------------------------------------------------------------------
        public static double GetMatrixStandardDeviation(RealMatrix matrix)
        {
            double matrixPopulationVariance = Statistician.GetMatrixPopulationVariance(matrix);

            return(Math.Sqrt(matrixPopulationVariance));
        }