Learn R Programming

StructuralDecompose

Please note that the package is currently submitted to CRAN. CRAN submissions take a long time. Please use the github download to access the code. Note: This website is under construction, please use the current version of R and Python here. The documentation will be updated in the coming days

StructuralDecompose is an algorithm suited to the decomposition of a time series into it's component terms of trend, seasonality and residuals. It is well suited to decompose a series in the presence of significant level shifts.

The algorithm outputs the decomposed trend, seasonality, residuals as well as anomalies detected.

Installation

You can install the development version of StructuralDecompose like so:

package(StructuralDecompose)
install_github("StructuralDecompose/StructuralDecompose")

Example

An example code:

Note that we can specify the break algorithm and the smoothing algorithm as well. If the setting is set to 'auto', it will optimize which algorithm to use.

It is best to keep the default algorithms.

library(StructuralDecompose)

StructuralDecompose <- function(Data, frequency = 12, break_algorithm = 'strucchange', smoothening_algorithm = 'lowess', break_level = 0.05, median_level = 0.5, mean_level = 0.5, level_length = 0.5, conf_level = 0.5)

Copy Link

Version

Install

install.packages('StructuralDecompose')

Monthly Downloads

226

Version

0.1.1

License

MIT + file LICENSE

Maintainer

Allen Sunny

Last Published

February 13th, 2023

Functions in StructuralDecompose (0.1.1)

MeanCleaning

Mean level checks
LevelCheck

Minimum level length checks
Smoothing

Smoothening of the time series
MedianCleaning

Median level checks
BreakPoints

Generation of breakpoints
AnomalyDetection

Automatic Anomaly detection
Nile_dataset

Nile River Dataset
StructuralDecompose

Main decomposition algorithm