Skip to contents

Prophet-style additive decomposition (linear trend + Fourier seasonality)

Usage

morie_prophet_components(x, period = 12)

Arguments

x

Numeric univariate series.

period

Seasonal period. Default 12.

Value

Named list with \(trend, seasonal, residual, slope, intercept, fourier_terms, period, n, method\).

Examples

set.seed(1)
morie_prophet_components(x = rnorm(50))
#> $trend
#>          1          2          3          4          5          6          7 
#> 0.11587831 0.11524852 0.11461872 0.11398892 0.11335912 0.11272933 0.11209953 
#>          8          9         10         11         12         13         14 
#> 0.11146973 0.11083994 0.11021014 0.10958034 0.10895054 0.10832075 0.10769095 
#>         15         16         17         18         19         20         21 
#> 0.10706115 0.10643135 0.10580156 0.10517176 0.10454196 0.10391217 0.10328237 
#>         22         23         24         25         26         27         28 
#> 0.10265257 0.10202277 0.10139298 0.10076318 0.10013338 0.09950358 0.09887379 
#>         29         30         31         32         33         34         35 
#> 0.09824399 0.09761419 0.09698439 0.09635460 0.09572480 0.09509500 0.09446521 
#>         36         37         38         39         40         41         42 
#> 0.09383541 0.09320561 0.09257581 0.09194602 0.09131622 0.09068642 0.09005662 
#>         43         44         45         46         47         48         49 
#> 0.08942683 0.08879703 0.08816723 0.08753744 0.08690764 0.08627784 0.08564804 
#>         50 
#> 0.08501825 
#> 
#> $seasonal
#>  [1] -0.42111560 -0.28323859  0.08828635  0.19550630 -0.30117613  0.05806018
#>  [7]  0.62349579  0.43385822  0.08210075 -0.08254563 -0.07159117 -0.32164049
#> [13] -0.42111560 -0.28323859  0.08828635  0.19550630 -0.30117613  0.05806018
#> [19]  0.62349579  0.43385822  0.08210075 -0.08254563 -0.07159117 -0.32164049
#> [25] -0.42111560 -0.28323859  0.08828635  0.19550630 -0.30117613  0.05806018
#> [31]  0.62349579  0.43385822  0.08210075 -0.08254563 -0.07159117 -0.32164049
#> [37] -0.42111560 -0.28323859  0.08828635  0.19550630 -0.30117613  0.05806018
#> [43]  0.62349579  0.43385822  0.08210075 -0.08254563 -0.07159117 -0.32164049
#> [49] -0.42111560 -0.28323859
#> 
#> $residual
#>           1           2           3           4           5           6 
#> -0.32121653  0.35163340 -1.03853368  1.28578558  0.51732478 -0.99125789 
#>           7           8           9          10          11          12 
#> -0.24816627  0.19299675  0.38284066 -0.33305290  1.47379200  0.60253318 
#>          13          14          15          16          17          18 
#> -0.30844573 -2.03915224  0.92958341 -0.34687126  0.17918431  0.78060427 
#>          19          20          21          22          23          24 
#>  0.09318344  0.05613093  0.73359425  0.76202936  0.04413338 -1.76910419 
#>          25          26          27          28          29          30 
#>  0.94017817  0.12697647 -0.34358544 -1.76513247 -0.27521791  0.26226719 
#>          31          32          33          34          35          36 
#>  0.63819936 -0.63300055  0.20984606 -0.06635442 -1.39993359 -0.18718949 
#>          37          38          39          40          41          42 
#> -0.06637997  0.13134938  0.91979300  0.47635323  0.04596611 -0.40147849 
#>          43          44          45          46          47          48 
#> -0.01595925  0.03400794 -0.85902368 -0.71248697  0.34926550  1.00389557 
#>          49          50 
#>  0.22312134  1.07932807 
#> 
#> $slope
#> [1] -0.0006297973
#> 
#> $intercept
#> [1] 0.1158783
#> 
#> $fourier_terms
#>           X1           X2           X3           X4           X5           X6 
#> -0.014019278 -0.312763433  0.138182198  0.022354881 -0.102574679 -0.213396991 
#>           X7           X8           X9          X10 
#> -0.018612975  0.078835217  0.050470562  0.003854728 
#> 
#> $period
#> [1] 12
#> 
#> $n
#> [1] 50
#> 
#> $method
#> [1] "Prophet-style linear-trend + Fourier(K=5) seasonality"
#>