public static float Variance(IEnumerable <float> values, Grouptype type) { var avg = values.Average(); var sse = values.Sum(f => Math.Pow(f - avg, 2)); var avgSse = sse / (values.Count() - (type == Grouptype.Population ? 0 : 1)); return((float)avgSse); }
public static float StdDeviation(IEnumerable <float> values, Grouptype type) { var stdDev = Math.Sqrt(Variance(values, type)); return((float)stdDev); }