trimmedMean
Computes the trimmed (truncated) mean by removing a fraction of values from each tail.
The trimmed mean sorts the data, discards the lowest and highest proportion of values, and computes the arithmetic mean of the remaining middle portion. This makes it more robust to outliers than the regular mean. A proportion of 0.0 gives the ordinary mean; a proportion approaching 0.5 converges toward the median.
Uses compensated (Neumaier) summation for improved numerical precision with large values.
Example:
doubleArrayOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).trimmedMean(0.1) // 5.5Return
the mean of the remaining values after trimming.
Parameters
the fraction of values to remove from each tail, in [0.0, 0.5). For example, 0.1 removes the lowest 10% and highest 10%.
See also
Computes the trimmed (truncated) mean by removing a fraction of values from each tail.
The trimmed mean sorts the data, discards the lowest and highest proportion of values, and computes the arithmetic mean of the remaining middle portion. This makes it more robust to outliers than the regular mean. A proportion of 0.0 gives the ordinary mean; a proportion approaching 0.5 converges toward the median.
Example:
listOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).trimmedMean(0.1) // 5.5Return
the mean of the remaining values after trimming.
Parameters
the fraction of values to remove from each tail, in [0.0, 0.5). For example, 0.1 removes the lowest 10% and highest 10%.
See also
Computes the trimmed (truncated) mean by removing a fraction of values from each tail.
The trimmed mean sorts the data, discards the lowest and highest proportion of values, and computes the arithmetic mean of the remaining middle portion. This makes it more robust to outliers than the regular mean. A proportion of 0.0 gives the ordinary mean; a proportion approaching 0.5 converges toward the median.
Example:
sequenceOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).trimmedMean(0.1) // 5.5Return
the mean of the remaining values after trimming.
Parameters
the fraction of values to remove from each tail, in [0.0, 0.5). For example, 0.1 removes the lowest 10% and highest 10%.