robust_decompose {tsrobprep}R Documentation

Robust time series seasonal decomposition

Description

Decompose a time series into trend, level and potentially multiple seasonal components including all interactions. The function allows for missings.

Usage

robust_decompose(
  x,
  S,
  wsize = max(2 * max(S), 25),
  use.trend = TRUE,
  K = 4,
  ICpen = "BIC",
  extreg = NULL,
  use.autoregressive = NULL
)

Arguments

x

a time series.

S

a number or vector describing the seasonalities (S_1, ..., S_K) in the data, e.g. c(24, 168) if the data consists of 24 observations per day and there is a weekly seasonality in the data.

wsize

is filter/rolling med size

use.trend

if TRUE, uses standard decomposition. If FALSE, uses no trend component.

K

a sigma (standard deviation) bound. The observations that exceed sigma*K become reduced weight in the regression.

ICpen

is the information criterion penalty, e.g. string "BIC", "HQC" or "AIC", or a fixed number.

extreg

a vector, matrix or data frame of data containing external regressors; each column is a variable.

use.autoregressive

if TRUE, removes the autoregression from the series. If NULL, it is derived data based.

Value

A list which contains a vector of fitted values, a vector of weights given to the original time series, and a matrix of components of the decomposition.⁠ ⁠

References

Narajewski M, Kley-Holsteg J, Ziel F (2021). “tsrobprep — an R package for robust preprocessing of time series data.” SoftwareX, 16, 100809. doi: 10.1016/j.softx.2021.100809.

Examples

## Not run: 
GBload.decomposed <- robust_decompose(GBload[,-1], S = c(48,7*48))
head(GBload.decomposed$components)

## End(Not run)

[Package tsrobprep version 0.3.2 Index]