如何检测一个ArrayList离群 [英] How to detect outliers in an ArrayList
问题描述
我试图想一些code,让我通过我的ArrayList搜索和检测的通用范围之外的任何值良好的价值观。
I'm trying to think of some code that will allow me to search through my ArrayList and detect any values outside the common range of "good values."
例如:
100
105
102
13
104
22
101
Example: 100 105 102 13 104 22 101
如何将能够写出code检测到(在这种情况下)13和22不会落在大约100好值?
How would I be able to write the code to detect that (in this case) 13 and 22 don't fall within the "good values" of around 100?
推荐答案
有几个标准一>检测异常值。最简单的,如 Chauvenet判据时,使用来自样本计算出的平均值和标准偏差确定一个正常范围的值。此范围以外的任何值被认为是一个局外人。
There are several criteria for detecting outliers. The simplest ones, like Chauvenet's criterion, use the mean and standard deviation calculated from the sample to determine a "normal" range for values. Any value outside of this range is deemed an outlier.
等标准的格拉布的测试并的迪克森的Q检验并可以给出比Chauvenet的,例如更好的结果。
Other criterions are Grubb's test and Dixon's Q test and may give better results than Chauvenet's for example if the sample comes from a skew distribution.
这篇关于如何检测一个ArrayList离群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!