Esempio n. 1
0
        static public string findSkew(decimal[] nums)
        {
            decimal mean   = Mean.findMean(nums);
            decimal median = Median.findMedian(nums);

            if (Mode.findMode(nums).Count == 1)
            {
                decimal mode = Mode.findMode(nums).First();
                if (mean > mode && median > mode)
                {
                    return("Positive Skewness");
                }
                else if (mode > median && mode > mean)
                {
                    return("Negative Skewness");
                }
            }

            if (mean > median)
            {
                return("Likely a Positive Skewness");
            }
            else
            {
                return("Likely a Negative Skewness");
            }
        }
Esempio n. 2
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. 3
0
        static public decimal findVariance(int[] nums)
        {
            decimal total = 0;
            decimal mean  = Mean.findMean(nums);

            foreach (int num in nums)
            {
                decimal temp = Math.Abs(mean - num);
                total += Multiplication.Product(temp, temp);
            }

            return(Division.Quotient(total, nums.Length));
        }
Esempio n. 4
0
        static public decimal findMeanDeviation(int[] arrayList)
        {
            decimal mean = Mean.findMean(arrayList);

            decimal[] meanList = new decimal[arrayList.Length];

            for (int i = 0; i < arrayList.Length; i++)
            {
                meanList[i] = arrayList[i] - mean;
            }

            decimal result = Mean.findMean(meanList);

            return(result);
        }
Esempio n. 5
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);
        }