コード例 #1
0
ファイル: StatisticsFuncs.cs プロジェクト: CodingWasaby/Mathy
        public static double[] grubbsd(double[] items, int alpha)
        {
            int n = items.Length;

            if (!(n >= 3 || n <= 100))
            {
                throw new Exception("Grubbs function: it is required that count of samples be within [3, 100].");
            }

            if (!(alpha == 1 || alpha == 5))
            {
                throw new Exception("Grubbs function: it is required that alpha be 1 or 5.");
            }


            double grubbs  = Grubbs.GetValue(alpha, n);
            double average = items.Average();
            double s       = stdvar(items);


            return(items.Where(i => Math.Abs(i - average) > grubbs * s).ToArray());
        }
コード例 #2
0
ファイル: StatisticsFuncs.cs プロジェクト: CodingWasaby/Mathy
 public static double tgrubbs(int n, int alpha)
 {
     return(Grubbs.GetValue(alpha, n));
 }