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.000 1160.000 1038.750 1210.000 1160.000 1160.000  813.000 1230.000
#>   [9] 1302.375 1140.000  995.000  935.000 1110.000  994.000 1020.000  960.000
#>  [17] 1180.000  799.000  958.000 1140.000 1100.000 1210.000 1150.000 1250.000
#>  [25] 1260.000 1220.000 1030.000 1100.000  817.625  840.000  874.000  817.625
#>  [33]  940.000  833.000  701.000  916.000  692.000 1020.000 1050.000  969.000
#>  [41]  831.000  726.000  550.625  824.000  702.000 1115.375 1100.000  832.000
#>  [49]  764.000  821.000  768.000  845.000  864.000  862.000  731.375  845.000
#>  [57]  744.000  796.000  958.625  759.000  781.000  865.000  845.000  944.000
#>  [65]  958.625  897.000  822.000  958.625  771.000  731.375  731.375  846.000
#>  [73]  812.000  742.000  801.000  958.625  860.000  874.000  848.000  890.000
#>  [81]  744.000  749.000  838.000 1050.000  918.000  986.000  797.000  923.000
#>  [89]  975.000  815.000 1020.000  906.000  901.000 1170.000  912.000  746.000
#>  [97]  919.000  718.000  714.000  740.000
#> 
#> $Anomalies
#>  [1]  3  9 29 32 43 46 55 59 65 68 70 71 76
#> 

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.833728 2.574466 1.308172 3.883472 4.620954 2.761029
#> [17] 4.631843 1.572953 4.498312 9.779931 5.011710 7.105424 7.617876 5.011710
#> [25] 9.290718 7.673694 5.011710 5.771912 7.262415 7.197004 1.281073 3.030063
#> [33] 3.707477 6.728191 5.311221 4.889541 7.357905 9.537189 2.623049 2.952099
#> [41] 7.121466 5.489610 6.775114 6.942559 1.864217 7.890401 7.927073 9.916411
#> [49] 9.734688 4.502645
#> 
#> $Anomalies
#> [1] 11 21 24 25 27
#>