public static double mean(double[] ArrayValues) { //int Sum = Addition.SumArrayValues(ArrayValues); int Sum = 0; foreach (int i in ArrayValues) { Sum = Sum + i; } int ValueCount = HelperClass.ArrayLenth(ArrayValues); int Value = Sum / ValueCount; return(Value); }
public static double variance(double[] ArrayValues) { double meanvalue = Mean.mean(ArrayValues); //int Sum = Addition.SumArrayValues(ArrayValues); double diff = 0; double varvalue = 0; foreach (double i in ArrayValues) { diff = meanvalue - i; diff = Math.Pow(diff, 2); varvalue = varvalue + diff; } int ValueCount = HelperClass.ArrayLenth(ArrayValues); varvalue = varvalue / ValueCount; return(varvalue); }