Esempio n. 1
0
        static public decimal score(int x, int[] nums)
        {
            decimal mean = Mean.findMean(nums);
            decimal SD   = StandardDeviation.findSD(nums);

            return(Division.Quotient((x - mean), SD));
        }
Esempio n. 2
0
        public static decimal findSampleCorrelation(int[] xArray, int[] yArray)
        {
            decimal xMean        = Mean.findMean(xArray);
            decimal yMean        = Mean.findMean(yArray);
            decimal xStandardDev = StandardDeviation.findSD(xArray);
            decimal yStandardDev = StandardDeviation.findSD(yArray);

            decimal stepOne = 0;

            decimal result;

            for (int i = 0; i < xArray.Length; i++)
            {
                stepOne += ((xArray[i] - xMean) * (yArray[i] - yMean));
            }

            decimal stepTwo = stepOne / (xStandardDev * yStandardDev);

            result = (stepTwo / (xArray.Length - 1));

            return(result);
        }