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()); }
public static double tgrubbs(int n, int alpha) { return(Grubbs.GetValue(alpha, n)); }