J
J
JaxxDexx2017-08-07 16:31:51
Python
JaxxDexx, 2017-08-07 16:31:51

How to use the Titien-Moore criterion?

There are a number of digital values ​​of length n. There may be several anomalous values ​​in this series (according to the maximum value). Tell me how to use the Titien-Moore test to determine these anomalous values. You can use the Smirnov-Grubbs criterion, it is very simple:

import math

def rem_anomalies(l):
  alpha = 2.447
  avg = sum(l) / len(l)
  sig = 0
  for i in l:
    sig += (i - avg) * (i - avg)
  sig = math.sqrt(sig/len(l))

  l2 = []
  for i in l:
    if alpha > (i - avg)/sig:
      l2.append(i)

  return l2

l = [1, 22, 123, 121, 11, 23, 1223, 11,43 ,12, 123, 142, 11, 2333, 121, 123]
print(l)
print(rem_anomalies(l))

> [1, 22, 123, 121, 11, 23, 1223, 11, 43, 12, 123, 142, 11, 121, 123]
But as we can see, it does not fit for several anomalies (in this example there were two anomalies - 2333, which the algorithm was able to determine, and 1223, which we missed)
I am not strong in algorithms, so if anyone knows and understands how to apply the Titien-Moore criterion or knows other criteria for finding several anomalous values, please tell me as simply as possible. Desirable (but not required) using pseudocode example 8)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Stolyarov, 2017-08-07
@JaxxDexx

The description of the algorithm and the logarithm critical value function was taken from here
JS example: https://jsfiddle.net/cs0m7r5h/11/

A
Alexander Skusnov, 2017-08-07
@AlexSku

There is a median filter to get rid of outliers.
More precisely, anomalies are not removed from the series, but are replaced by average values.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question