Skip to contents

Automatic Anomaly detection

Usage

AnomalyDetection(
  timeseries,
  frequency = 52,
  conf_level = 1.5,
  breaks,
  window_len = 14
)

Arguments

timeseries

Given time series

frequency

Timeseries frequency, defaults to 12 points

conf_level

Confidence level for Anomaly detection

breaks

breakpoints identified

window_len

Window length for anomaly detection

Value

the list of anomalies in the time series, along with the time series plot

Examples

AnomalyDetection(timeseries = StructuralDecompose::Nile_dataset[,1], breaks = c(4, 50, 80))
#> $DeAnomalized_series
#>   [1] 1120.0000 1160.0000 1039.9245 1210.0000 1160.0000 1160.0000  814.8112
#>   [8] 1230.0000 1315.1888 1140.0000  995.0000  935.0000 1110.0000  994.0000
#>  [15] 1020.0000  960.0000 1180.0000  814.8112  958.0000 1140.0000 1100.0000
#>  [22] 1210.0000 1150.0000 1250.0000 1260.0000 1220.0000 1030.0000 1100.0000
#>  [29]  849.8112  849.8112  874.0000  849.8112  940.0000  833.0000  701.0000
#>  [36]  916.0000  692.0000 1020.0000 1050.0000  969.0000  831.0000  726.0000
#>  [43]  581.8112  824.0000  702.0000 1082.1888 1076.6888  832.0000  764.0000
#>  [50]  821.0000  768.0000  845.0000  864.0000  862.0000  720.4616  845.0000
#>  [57]  744.0000  796.0000  969.5384  759.0000  781.0000  865.0000  845.0000
#>  [64]  944.0000  958.5384  897.0000  822.0000  958.5384  771.0000  709.4616
#>  [71]  709.4616  846.0000  812.0000  742.0000  801.0000  958.5384  860.0000
#>  [78]  874.0000  848.0000  890.0000  747.4314  749.0000  838.0000 1050.0000
#>  [85]  918.0000  986.0000  797.0000  923.0000  975.0000  815.0000 1020.0000
#>  [92]  906.0000  901.0000 1076.5686  907.5686  746.0000  907.5686  718.0000
#>  [99]  714.0000  740.0000
#> 
#> $Anomalies
#>  [1]  3  7  9 18 29 30 32 43 46 47 55 59 65 68 70 71 76 81 94 95 97
#> 

AnomalyDetection(timeseries = runif(n = 50, min = 1, max = 10),  breaks = c(4, 20, 30))
#> $DeAnomalized_series
#>  [1] 1.726751 8.508997 6.406848 2.414876 1.066595 5.197541 5.479996 3.607905
#>  [9] 7.595938 7.952694 8.871406 2.574466 1.308172 3.883472 4.620954 2.761029
#> [17] 4.631843 1.572953 4.498312 9.779931 5.036528 7.105424 7.617876 5.036528
#> [25] 9.265900 7.673694 5.036528 5.771912 7.262415 7.197004 1.456328 3.030063
#> [33] 3.707477 6.728191 5.311221 4.889541 7.357905 9.344504 2.623049 2.952099
#> [41] 7.121466 5.489610 6.775114 6.942559 3.964649 7.890401 7.927073 9.916411
#> [49] 9.734688 4.502645
#> 
#> $Anomalies
#> [1] 21 24 25 27 31 38 45
#>