예제 #1
0
 public void ConfidenceIntervalTest()
 {
     var summary = new StatSummary(Enumerable.Range(1, 30));
     Print(summary);
     Assert.Equal(12.34974, summary.ConfidenceInterval.Lower, 4);
     Assert.Equal(18.65026, summary.ConfidenceInterval.Upper, 4);
 }
예제 #2
0
 private void Print(StatSummary summary)
 {
     output.WriteLine("Min = " + summary.Min);
     output.WriteLine("LowerFence = " + summary.LowerFence);
     output.WriteLine("Q1 = " + summary.Q1);
     output.WriteLine("Median = " + summary.Median);
     output.WriteLine("Mean = " + summary.Mean);
     output.WriteLine("Q3 = " + summary.Q3);
     output.WriteLine("UpperFence = " + summary.UpperFence);
     output.WriteLine("Max = " + summary.Max);
     output.WriteLine("InterquartileRange = " + summary.InterquartileRange);
     output.WriteLine("StandardDeviation = " + summary.StandardDeviation);
     output.WriteLine("Outlier = [" + string.Join("; ", summary.Outlier) + "]");
     output.WriteLine("CI (95%) = " + summary.ConfidenceInterval);
 }
예제 #3
0
 public void Test3()
 {
     var summary = new StatSummary(1, 2, 4);
     Print(summary);
     Assert.Equal(1, summary.Min);
     Assert.Equal(-3.5, summary.LowerFence);
     Assert.Equal(1, summary.Q1);
     Assert.Equal(2, summary.Median);
     Assert.Equal(2.333333, summary.Mean, 5);
     Assert.Equal(4, summary.Q3);
     Assert.Equal(8.5, summary.UpperFence);
     Assert.Equal(4, summary.Max);
     Assert.Equal(3, summary.InterquartileRange);
     Assert.Equal(1.52753, summary.StandardDeviation, 4);
     Assert.Equal(new double[0], summary.Outlier);
 }
예제 #4
0
 public void Test2()
 {
     var summary = new StatSummary(1, 2);
     Print(summary);
     Assert.Equal(1, summary.Min);
     Assert.Equal(-0.5, summary.LowerFence);
     Assert.Equal(1, summary.Q1);
     Assert.Equal(1.5, summary.Median);
     Assert.Equal(1.5, summary.Mean);
     Assert.Equal(2, summary.Q3);
     Assert.Equal(3.5, summary.UpperFence);
     Assert.Equal(2, summary.Max);
     Assert.Equal(1, summary.InterquartileRange);
     Assert.Equal(0.70711, summary.StandardDeviation, 4);
     Assert.Equal(new double[0], summary.Outlier);
 }
예제 #5
0
 public void Test7()
 {
     var summary = new StatSummary(1, 2, 4, 8, 16, 32, 64);
     Print(summary);
     Assert.Equal(1, summary.Min);
     Assert.Equal(-43, summary.LowerFence);
     Assert.Equal(2, summary.Q1);
     Assert.Equal(8, summary.Median);
     Assert.Equal(18.1428571429, summary.Mean, 5);
     Assert.Equal(32, summary.Q3);
     Assert.Equal(77, summary.UpperFence);
     Assert.Equal(64, summary.Max);
     Assert.Equal(30, summary.InterquartileRange);
     Assert.Equal(22.9378, summary.StandardDeviation, 4);
     Assert.Equal(new double[0], summary.Outlier);
 }
예제 #6
0
 public void OutlierTest()
 {
     var summary = new StatSummary(1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 10, 10.1);
     Print(summary);
     Assert.Equal(new[] { 10, 10.1 }, summary.Outlier);
 }
예제 #7
0
 public void ConfidenceIntervalTest()
 {
     var summary = new StatSummary(Enumerable.Range(1, 30));
     Print(summary);
     Assert.Equal(95, summary.ConfidenceInterval.Level.ToPercent());
     Assert.Equal(15.5, summary.ConfidenceInterval.Mean);
     Assert.Equal(summary.StandardError, summary.ConfidenceInterval.Error);
     Assert.Equal(12.34974, summary.ConfidenceInterval.Lower, 4);
     Assert.Equal(18.65026, summary.ConfidenceInterval.Upper, 4);
 }
 public BenchmarkRunReportsStatistic(string name, IList<BenchmarkRunReport> runReports)
 {
     Name = name;
     AverageTime = new StatSummary(runReports.Select(r => r.AverageNanoseconds));
     OperationsPerSeconds = new StatSummary(runReports.Select(r => r.OpsPerSecond));
 }
 private string Format(StatSummary stat, TimeUnit timeUnit)
 {
     var value = calc(stat);
     return isTimeColumn ? value.ToTimeStr(timeUnit) : value.ToStr();
 }