Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/15 16:09:10 (9 years ago)
Author:
ascheibe
Message:

#2031 implemented review comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/Statistics/EnumerableStatisticsExtension.cs

    r11703 r11914  
    2828  public static class EnumerableStatisticExtensions {
    2929    public static Tuple<double, double> ConfidenceIntervals(this IEnumerable<double> values, double alpha) {
    30       if (values.Count() <= 1) return new Tuple<double, double>(double.NaN, double.NaN);
     30      return ConfidenceIntervals(values.ToArray(), alpha);
     31    }
    3132
     33    public static Tuple<double, double> ConfidenceIntervals(this double[] values, double alpha) {
    3234      double lower, upper;
     35      int n = values.Length;
     36      if (n <= 1) return new Tuple<double, double>(double.NaN, double.NaN);
     37
    3338      double s = values.StandardDeviation();
    3439      double x = values.Average();
    35       int n = values.Count();
    3640      double t = alglib.invstudenttdistribution(n - 1, (1.0 - alpha) / 2.0);
    3741
Note: See TracChangeset for help on using the changeset viewer.