
Main decomposition algorithm
StructuralDecompose.Rd
Main decomposition algorithm
Usage
StructuralDecompose(
Data,
frequency = 12,
break_algorithm = "strucchange",
smoothening_algorithm = "lowess",
break_level = 0.05,
median_level = 0.5,
mean_level = 0.5,
level_length = 12,
conf_level = 0.5,
window_len = 12,
plot = FALSE
)
Arguments
- Data
Time series required
- frequency
Frequency of the tine series
- break_algorithm
breakpoints algorithm used. Defaults to strucchange
- smoothening_algorithm
Smoothing algorithm used. Defaults to lowess
- break_level
Break level for the breakpoints algorithm
- median_level
Average median distance between two level
- mean_level
Average mean distance between a group of points near breakpoints
- level_length
Minimum number of points required to determine a level
- conf_level
Confidence level for Anomaly detection, best to keep this a static value
- window_len
Length of the Moving window for Anomaly Detection
- plot
True of False indicating if you want the internal plots to be generated
Examples
StructuralDecompose(Data = StructuralDecompose::Nile_dataset[,1])
#> $anomalies
#> [1] 2 3 4 5 6 7 8 9 11 12 14 15 16 17 18 19 21 22 24 25 26 27 28
#>
#> $trend_line
#> [1] 1137.9436 1136.9709 1135.8318 1134.5272 1133.0949 1131.5766 1129.9997
#> [8] 1128.3720 1126.6193 1124.3596 1122.3628 1120.5238 1119.1214 1118.1976
#> [15] 1117.9579 1118.7292 1120.9707 1124.5740 1128.7926 1132.5750 1134.4106
#> [22] 1135.6300 1136.7808 1137.9552 1139.1380 1140.2664 1141.2516 1142.0037
#> [29] 833.5024 833.5034 833.4934 833.4752 833.4514 833.4272 833.4065
#> [36] 833.3932 833.3944 833.4166 833.4689 833.5577 833.6851 833.8489
#> [43] 834.0452 834.2708 834.5215 834.7923 835.0776 835.3642 835.6231
#> [50] 835.8033 835.8232 835.5759 835.2999 834.8540 834.2970 833.6987
#> [57] 833.1498 832.7101 832.4310 832.3386 832.4194 832.6920 833.1493
#> [64] 833.7915 834.6195 835.6680 836.9777 838.5399 840.3426 842.3489
#> [71] 844.4798 846.6768 848.9136 851.1488 853.3382 855.4136 857.2771
#> [78] 858.9158 859.7719 860.1453 860.2497 860.2100 860.1021 859.9751
#> [85] 859.8599 859.7724 859.7192 859.7005 859.7147 859.7568 859.8183
#> [92] 859.8904 859.9611 860.0171 860.0440 860.0260 859.9471 859.7946
#> [99] 859.5564 859.2252
#>
#> $Deseaonalized_Series
#> Jan Feb Mar Apr May
#> 1 -13.79996020 9.15951109 -128.23318570 35.55827994 -13.79778120
#> 2 -4.97778524 -138.06719452 -53.35925221 -198.64365622 18.32644548
#> 3 125.00558964 65.86401628 -66.65301349 -81.91819624 -100.20522515
#> 4 -137.25075351 172.71384754 261.12975658 95.52785603 -43.38797374
#> 5 -67.47950409 -28.67283932 -23.22455729 -30.49032285 -12.00281222
#> 6 -47.27580212 18.43841179 56.44936508 70.29403756 108.67761975
#> 7 -32.76998023 -123.01839193 -7.73956747 144.67189779 -37.97994107
#> 8 62.28370569 112.35806718 -18.12052774 23.38503860 74.58241387
#> 9 63.19648478 -155.66416581 -100.95780574 -159.13963370
#> Jun Jul Aug Sep Oct
#> 1 69.84266810 -214.83755465 71.85955779 246.05259492 -35.20494609
#> 2 -284.15469222 -68.63050404 -22.34345550 -31.73866233 23.52462332
#> 3 47.91588413 142.66874858 -169.24364916 109.22052040 -51.27261762
#> 4 -66.42967882 -275.88310425 -40.03924468 -129.84961767 234.36233810
#> 5 68.56531407 -34.13484230 -18.46713350 -86.47784446 -87.55552757
#> 6 102.75128473 87.18447056 141.69159760 -66.67070337 -217.19432164
#> 7 56.50345206 90.39022461 0.08620437 -113.57776122 -162.05538893
#> 8 -3.33752286 262.34380886 16.34115827 43.71081931 259.13749416
#> 9
#> Nov Dec
#> 1 -140.30056015 -192.48082986
#> 2 0.28149297 105.08782557
#> 3 -145.34420895 75.64974751
#> 4 251.98467953 -10.32121709
#> 5 194.63125342 -80.29562314
#> 6 -208.41758498 -7.63383431
#> 7 -35.03985770 183.06785230
#> 8 39.01823306 -120.98299385
#> 9
#>
#> $breakpoints
#> [1] 0 28 100
#>
#> $trend
#> Jan Feb Mar Apr May Jun
#> 1 -2.58068534 -5.22031428 -7.85994322 -11.66249675 -15.46505027 -20.24872233
#> 2 -71.37236741 -79.35121240 -87.33005740 -85.73692004 -84.14378268 -70.14213019
#> 3 5.29525755 8.12230681 10.94935607 6.20807710 1.46679812 -5.26470287
#> 4 12.12075784 6.20232976 0.28390168 4.58190374 8.87990580 12.03022044
#> 5 7.82859501 7.97857547 8.12855592 0.68594670 -6.75666253 -10.45680279
#> 6 22.18232637 29.05741313 35.93249990 31.65748635 27.38247280 17.42298235
#> 7 -31.34554077 -29.52398082 -27.70242087 -21.77575607 -15.84909127 -7.62981942
#> 8 27.23752034 38.44764094 49.65776153 60.15099926 70.64423699 68.79267994
#> 9 -36.47875612 -56.56470068 -76.65064523 -98.29738163
#> Jul Aug Sep Oct Nov Dec
#> 1 -25.03239439 -30.08582834 -35.13926228 -42.06844238 -48.99762247 -60.18499494
#> 2 -56.14047769 -42.49951508 -28.85855246 -19.32577573 -9.79299899 -2.24887072
#> 3 -11.99620386 -7.79186271 -3.58752156 5.97956019 15.54664193 13.83369988
#> 4 15.18053508 8.83694475 2.49335441 -1.07112296 -4.63560033 1.59649734
#> 5 -14.15694304 -10.93245758 -7.70797212 -1.93055623 3.84685967 13.01459302
#> 6 7.46349189 -1.43600089 -10.33549366 -17.81748480 -25.29947594 -28.32250835
#> 7 0.58945242 6.75330236 12.91715231 14.97607049 17.03498868 22.13625451
#> 8 66.94112288 50.59555288 34.24998288 17.07958925 -0.09080439 -18.28478025
#> 9
#>
#> $seasonality
#> Jan Feb Mar Apr May Jun
#> 1 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 2 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 3 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 4 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 5 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 6 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 7 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 8 -4.143600 13.869559 -44.598627 39.914473 40.702863 -41.419268
#> 9 -4.143600 13.869559 -44.598627 39.914473
#> Jul Aug Sep Oct Nov Dec
#> 1 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 2 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 3 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 4 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 5 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 6 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 7 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 8 -102.162131 29.768482 -2.671910 50.845392 12.937743 6.957018
#> 9
#>
#> $remainder
#> Jan Feb Mar Apr May Jun
#> 1 -11.219275 14.379825 -120.373242 47.220777 1.667269 90.091390
#> 2 66.394582 -58.715982 33.970805 -112.906736 102.470228 -214.012562
#> 3 119.710332 57.741709 -77.602370 -88.126273 -101.672023 53.180587
#> 4 -149.371511 166.511518 260.845855 90.945952 -52.267880 -78.459899
#> 5 -75.308099 -36.651415 -31.353113 -31.176270 -5.246150 79.022117
#> 6 -69.458128 -10.619001 20.516865 38.636551 81.295147 85.328302
#> 7 -1.424439 -93.494411 19.962853 166.447654 -22.130850 64.133271
#> 8 35.046185 73.910426 -67.778289 -36.765961 3.938177 -72.130203
#> 9 99.675241 -99.099465 -24.307161 -60.842252
#> Jul Aug Sep Oct Nov Dec
#> 1 -189.805160 101.945386 281.191857 6.863496 -91.302938 -132.295835
#> 2 -12.490026 20.156060 -2.880110 42.850399 10.074492 107.336696
#> 3 154.664952 -161.451786 112.808042 -57.252178 -160.890851 61.816048
#> 4 -291.063639 -48.876189 -132.342972 235.433461 256.620280 -11.917714
#> 5 -19.977899 -7.534676 -78.769872 -85.624971 190.784394 -93.310216
#> 6 79.720979 143.127598 -56.335210 -199.376837 -183.118109 20.688674
#> 7 89.800772 -6.667098 -126.494914 -177.031459 -52.074846 160.931598
#> 8 195.402686 -34.254395 9.460836 242.057905 39.109037 -102.698214
#> 9
#>
StructuralDecompose(Data = runif(n = 50, min = 1, max = 10))
#> $anomalies
#> logical(0)
#>
#> $trend_line
#> [1] 5.253967 5.297710 5.339358 5.378703 5.415937 5.451580 5.486530 5.521685
#> [9] 5.557789 5.595333 5.634945 5.676998 5.721784 5.769152 5.817696 5.863362
#> [17] 5.892630 5.865263 5.806145 5.721351 5.624649 5.528632 5.440812 5.363997
#> [25] 5.301282 5.257683 5.227365 5.202206 5.170720 5.123643 5.063829 4.993975
#> [33] 4.918056 4.844674 4.862009 4.919900 4.996134 5.081648 5.173100 5.269070
#> [41] 5.368585 5.470787 5.575381 5.682512 5.792665 5.906615 6.024910 6.148051
#> [49] 6.276301 6.409729
#>
#> $Deseaonalized_Series
#> Jan Feb Mar Apr May Jun Jul
#> 1 -1.0611874 0.8191308 -3.9296804 -1.1585348 -0.5239543 2.4948138 1.7467734
#> 2 1.0092746 -3.9348712 -0.5298839 1.7329313 1.3666650 0.8368495 -2.8134429
#> 3 1.6264279 1.3862309 3.4808892 -4.1539973 -0.6471379 -2.5475088 2.3618503
#> 4 0.3983869 -2.0509442 0.3105621 2.9034628 -0.8797504 -1.3902505 -1.8232016
#> 5 -2.2384105 3.5593957
#> Aug Sep Oct Nov Dec
#> 1 5.2541019 -3.0297266 4.8235595 -3.0022641 0.2111549
#> 2 -3.1829828 3.8648013 -2.2199589 0.7126374 2.6424574
#> 3 0.9167170 -3.5652389 -2.0050855 2.7227773 -2.9374202
#> 4 -3.2904569 2.6529360 -0.4790291 -0.1169709 0.3581321
#> 5
#>
#> $breakpoints
#> [1] 0 50
#>
#> $trend
#> Jan Feb Mar Apr May Jun
#> 1 -0.568409444 -0.412547039 -0.256684634 -0.141416075 -0.026147515 0.058930966
#> 2 0.149260280 -0.029237973 -0.207736226 -0.239914722 -0.272093217 -0.133734015
#> 3 0.310328705 0.283877034 0.257425363 0.120196367 -0.017032629 -0.209675114
#> 4 -0.489891054 -0.518272157 -0.546653261 -0.500034202 -0.453415143 -0.383098965
#> 5 0.323875693 0.450864415
#> Jul Aug Sep Oct Nov Dec
#> 1 0.144009448 0.240993213 0.337976979 0.391336835 0.444696691 0.296978485
#> 2 0.004625187 0.167541084 0.330456981 0.339956350 0.349455719 0.329892212
#> 3 -0.402317600 -0.506880665 -0.611443730 -0.562872816 -0.514301902 -0.502096478
#> 4 -0.312782787 -0.216690205 -0.120597624 -0.014983001 0.090631621 0.207253657
#> 5
#>
#> $seasonality
#> Jan Feb Mar Apr May Jun Jul
#> 1 1.6003069 -0.1955980 0.4536612 0.2749799 -2.3408154 -0.7298611 -0.1564265
#> 2 1.6003069 -0.1955980 0.4536612 0.2749799 -2.3408154 -0.7298611 -0.1564265
#> 3 1.6003069 -0.1955980 0.4536612 0.2749799 -2.3408154 -0.7298611 -0.1564265
#> 4 1.6003069 -0.1955980 0.4536612 0.2749799 -2.3408154 -0.7298611 -0.1564265
#> 5 1.6003069 -0.1955980
#> Aug Sep Oct Nov Dec
#> 1 -1.2591336 0.2379129 -0.7011551 1.8511855 0.9649424
#> 2 -1.2591336 0.2379129 -0.7011551 1.8511855 0.9649424
#> 3 -1.2591336 0.2379129 -0.7011551 1.8511855 0.9649424
#> 4 -1.2591336 0.2379129 -0.7011551 1.8511855 0.9649424
#> 5
#>
#> $remainder
#> Jan Feb Mar Apr May Jun
#> 1 -0.49277794 1.23167780 -3.67299580 -1.01711876 -0.49780680 2.43588280
#> 2 0.86001434 -3.90563319 -0.32214767 1.97284599 1.63875826 0.97058348
#> 3 1.31609917 1.10235382 3.22346385 -4.27419368 -0.63010529 -2.33783372
#> 4 0.88827799 -1.53267199 0.85721532 3.40349701 -0.42633525 -1.00715149
#> 5 -2.56228618 3.10853132
#> Jul Aug Sep Oct Nov Dec
#> 1 1.60276391 5.01310870 -3.36770361 4.43222272 -3.44696079 -0.08582363
#> 2 -2.81806807 -3.35052389 3.53434428 -2.55991521 0.36318170 2.31256517
#> 3 2.76416793 1.42359770 -2.95379519 -1.44221266 3.23707923 -2.43532369
#> 4 -1.51041883 -3.07376674 2.77353364 -0.46404608 -0.20760253 0.15087849
#> 5
#>