Changeset 11699 for branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/EnumerableStatisticsExtension.cs
- Timestamp:
- 12/19/14 12:46:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/EnumerableStatisticsExtension.cs
r11375 r11699 35 35 double x = values.Average(); 36 36 int n = values.Count(); 37 double t = alglib. studenttdistribution(n - 1, 1 - (alpha / 2));37 double t = alglib.invstudenttdistribution(n - 1, (1.0 - alpha) / 2.0); 38 38 39 lower = x -t * (s / Math.Sqrt(n));40 upper = x +t * (s / Math.Sqrt(n));39 lower = x + t * (s / Math.Sqrt(n)); 40 upper = x - t * (s / Math.Sqrt(n)); 41 41 42 42 return new Tuple<double, double>(lower, upper); 43 43 } 44 45 // Bessel corrected variance46 public static double EstimatedVariance(this IEnumerable<double> values) {47 double n = values.Count();48 return values.Variance() * n / (n - 1);49 }50 51 // Bessel corrected standard deviation52 public static double EstimatedStandardDeviation(this IEnumerable<double> values) {53 double n = values.Count();54 return values.StandardDeviation() * n / (n - 1);55 }56 44 } 57 45 }
Note: See TracChangeset
for help on using the changeset viewer.