HYBRIDTEST2
outlier
gts
The HYBRIDTEST2
function detects outliers in a GTS (or a LIST of GTS) which has a seasonal part.
HYBRIDTEST2
is almost the same procedure than HYBRIDTEST
except that it does not use STL
decomposition for the
seasonal extract.
The seasonal part is approximated by pondering each value with the entropy of the
modified Z-score of its seasonal subseries (series with only the values of the
same season).
This test is usually preferred when it is meaningful to think in term of entropy, for example when the GTS represents counters of events. Also as it
does not use STL
decomposition, it is not prone to border effects, but at the cost of not detecting slight outliers.
This function only applies to bucketized
GTS of type DOUBLE.
HYBRIDTEST2 is available since version 1.0.0.
See also
Signatures
Examples
// Macro used to generate an approximately normal distribution (using central limit theorem)
<% RAND RAND RAND RAND RAND RAND + + + + + 3.0 - %> 'normal' STORE
// we generate a GTS with an approximately normal distribution
[ NEWGTS 1 100 <% NaN NaN NaN @normal ADDVALUE %> FOR
// we add outliers
25 NaN NaN NaN -17 ADDVALUE
36 NaN NaN NaN 18 ADDVALUE
71 NaN NaN NaN 23 ADDVALUE
82 NaN NaN NaN -12 ADDVALUE
DEDUP
// we generate a periodic GTS of mean 0
NEWGTS 1 100 <% NaN NaN NaN 4 PICK 10 % 4.5 - ADDVALUE %> FOR
// we generate a trend GTS (piecewise raise)
NEWGTS 1 100 <% NaN NaN NaN 4 PICK 50 / 5 + ADDVALUE %> FOR ]
// we sum up the 3 components: remainder, seasonal and trend
[ SWAP [] reducer.sum ] REDUCE 'sum' RENAME
// bucketize
[ SWAP bucketizer.first 0 1 100 ] BUCKETIZE 0 GET
// we call HYBRIDTEST2
10 5 2 HYBRIDTEST2