grubbsTestIterative
fun grubbsTestIterative(sample: DoubleArray, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED): GrubbsIterativeResult(source)
Performs iterative Grubbs' test to detect multiple outliers.
Repeatedly applies grubbsTest to the data: when an outlier is found significant at level alpha, it is removed and the test is rerun on the remaining data. The procedure stops when no further outlier is significant or fewer than 3 observations remain.
Example:
val data = doubleArrayOf(10.0, 11.0, 12.0, 13.0, 14.0, 80.0, 90.0)
val result = grubbsTestIterative(data, alpha = 0.05)
result.outlierIndices // e.g. [6, 5] — indices in the original array
result.cleanedData // observations with outliers removed
result.iterations // TestResult for each roundContent copied to clipboard
Return
a GrubbsIterativeResult with outlier indices, cleaned data, and per-iteration results.
Parameters
sample
the observed values. Must have at least 3 elements.
alpha
the significance level for each iteration. Must be in (0, 1). Defaults to 0.05.
alternative
the direction of the alternative hypothesis, passed to each grubbsTest call. Defaults to Alternative.TWO_SIDED.