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] 5.208319 2.775570 1.726754 7.908705 3.069984 4.867319 8.208279 7.171074
#>  [9] 7.741773 1.741895 6.371062 3.990639 9.721159 9.330400 9.859297 4.257190
#> [17] 9.812866 7.228583 2.387984 5.082857 9.589977 9.285133 8.755611 9.556073
#> [25] 9.070205 5.839838 2.521248 5.371326 2.521248 2.521248 1.005063 2.654031
#> [33] 4.950402 3.104948 3.487215 4.940405 1.712332 4.476543 9.438007 1.677659
#> [41] 4.706442 8.975365 8.398878 1.671612 2.506423 1.815847 2.988215 9.491956
#> [49] 3.846032 9.323051
#> 
#> $Anomalies
#> [1]  4 27 29 30
#>