删除“错误号码”

时间:2012-03-12 19:01:23

标签: vb.net windows-phone-7 math statistics

我正在尝试使用vb.net构建一个Windows Phone 7应用程序

我需要清除我的列表框:

  

932 100 592 21 924 641 200 1230 5200 842 951 658

我想删除“错误号码”,因为我想获得平均值。 在这种情况下,错误的数字是: 太低了:100,21,200 太高了:5200

我只想找到一种方法来做到这一点

For each items in listbox 
 calc the avarage
Next

for each item in listbox
 if item < avarage/2 then
 remove item
 end if
 if item > avarage*2 then
 remove item
 end if
next

for each item in listbox
calc the avarage
next

1 个答案:

答案 0 :(得分:2)

这是如何在一系列值中找到异常值的方法:

  1. 计算所有积分的平均值:m

  2. 计算标准差:s

  3. 对于v abs(v - m) > s的每个点vm = sum(v0, v1, ...) / N diff = sum((v0-m)^2, (v1-m)^2, ...) / N s = sqrt(diff) for each value v if abs(v - m) > s then remove v end if end for 是异常值。

  4. 这是执行此操作的伪代码:

    average = sum(V0, V1, ...) / M
    

    现在,你有M个值,你可以计算它们的平均值:

    {{1}}