/// <summary> /// Get the computed mean value of all recorded values in the histogram /// </summary> /// <returns>the mean value (in value units) of the histogram data</returns> public static double GetMean(this HistogramBase histogram) { var totalCount = histogram.TotalCount; if (totalCount == 0) { return(0); } var totalValue = histogram.RecordedValues().Select(hiv => hiv.TotalValueToThisValue).LastOrDefault(); return((totalValue * 1.0) / totalCount); }
/// <summary> /// Get the computed standard deviation of all recorded values in the histogram /// </summary> /// <returns>the standard deviation (in value units) of the histogram data</returns> public static double GetStdDeviation(this HistogramBase histogram) { var mean = histogram.GetMean(); var geometricDeviationTotal = 0.0; foreach (var iterationValue in histogram.RecordedValues()) { double deviation = (histogram.MedianEquivalentValue(iterationValue.ValueIteratedTo) * 1.0) - mean; geometricDeviationTotal += (deviation * deviation) * iterationValue.CountAddedInThisIterationStep; } var stdDeviation = Math.Sqrt(geometricDeviationTotal / histogram.TotalCount); return(stdDeviation); }
/// <summary> /// Get the highest recorded value level in the histogram /// </summary> /// <returns>the Max value recorded in the histogram</returns> public static long GetMaxValue(this HistogramBase histogram) { var max = histogram.RecordedValues().Select(hiv => hiv.ValueIteratedTo).LastOrDefault(); return(histogram.HighestEquivalentValue(max)); }