Source: NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.17.3, which
states Rosner (1983, Technometrics 25, 165-172) in full: R_i = max |x_i - xbar|
/ s recomputed after each removal, with critical values lambda_i = (n-i)
t_{p,n-i-1} / sqrt((n-i-1+t^2)(n-i+1)) and p = 1 - alpha / (2(n-i+1)). The
number of outliers is the largest i with R_i > lambda_i. The handbook
worked example (Rosner 54-point data set, r = 10, alpha = 0.05) gives R_1 =
3.118, lambda_1 = 3.158 and three outliers.
Examples
Gesd(c(1:20, 40), 0.05, 3)$n_outliers
#> [1] 1
