Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/19/14 12:46:06 (9 years ago)
Author:
ascheibe
Message:

#2031

  • fixed confidence intervals calculation
  • added more unit tests
  • some cosmetic changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/EnumerableStatisticsExtension.cs

    r11375 r11699  
    3535      double x = values.Average();
    3636      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);
    3838
    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));
    4141
    4242      return new Tuple<double, double>(lower, upper);
    4343    }
    44 
    45     // Bessel corrected variance
    46     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 deviation
    52     public static double EstimatedStandardDeviation(this IEnumerable<double> values) {
    53       double n = values.Count();
    54       return values.StandardDeviation() * n / (n - 1);
    55     }
    5644  }
    5745}
Note: See TracChangeset for help on using the changeset viewer.