Rlgt-package: Getting started with the Rlgt package

Rlgt-packageR Documentation

Getting started with the Rlgt package

Description

An implementation of Bayesian ETS models named LGT (for non-seasonal time series data) and SGT (for seasonal time series data). These models have been tested on the M3 competition dataset in which they outperform all of the models originally participating in the competition.

Getting started

The best way to get started with the package is to have a look at the vignettes and the various demos that ship with the package. There is a vignette with examples of how to use the various methods included in the package, and a vignette that discusses some of the theoretical background.

As to the demos, you can find their source code in the "demo" subfolder in the package sources (available on CRAN). There are some basic demos and other more advanced ones that run on subsets of the M3 dataset and run potentially for hours.

The package contains models for seasonal and non-seasonal data, allows for external regressors, and different error distributions. In the following, we briefly also present some of the theoretical background of the methods.

LGT (Local and Global Trend)

The LGT model is constructed based on Holt’s linear trend method. The model is designed to allow for a more general term of error by allowing for heteroscedasticity and an addition of constant "global" trend in the model.

Model Equations

In terms of mathematical notation, the model can be fully represented as follows:

y_{t+1} \sim Student (\nu,y_{t+1}, \sigma _{t+1}) \quad (eq.1.1)

\widehat{y}_{t+1}=l_{t}+ \gamma l_{t}^{ \rho }+ \lambda b_{t} \quad (eq. 1.2)

l_{t+1}= \alpha y_{t+1}+ \left( 1- \alpha \right) \left( l_{t} \right) \quad (eq. 1.3)

b_{t+1}= \beta \left( l_{t+1}-l_{t} \right) + \left( 1- \beta \right) b_{t} \quad (eq. 1.4)

\widehat{\sigma}_{t+1}= \sigma l_{t}^{ \tau}+ \xi \quad (eq. 1.5)

Notations

y_{t}

value of the dependent variable of interest at time t

\widehat{y}_{t+1}

forecasted value of y at time t+1 given information up to time t

\widehat{\sigma}_{t+1}

forecasted deviation at time t+1 given information up to time t

l_{t}

level at time t

b_{t}

local trend at time t

Parameters

\nu

degrees of freedom of the t-distribution

\gamma

coefficient of the global trend

\rho

power coefficient of the global trend

\lambda

damping coefficient of the local trend

\alpha

smoothing parameter for the level term

\beta

smoothing parameter for the local trend term

\sigma

coefficient of the size of error function

\tau

power coefficient of the size of error function

\xi

base or minimum value of the size of error function

SGT (Seasonal, Global Trend)

The SGT model was designed as a seasonal counterpart to the LGT model. Similar to LGT, this model is devised to allow for a global trend term and heteroscedastic error.

Model Equations

y_{t+1} \sim Student \left( \nu,\widehat{y}_{t+1}, \sigma _{t+1} \right) \quad (eq. 2.1)

\widehat{y}_{t+1}= \left( l_{t}+ \gamma l_{t}^{ \rho } \right) s_{t+1} \quad (eq. 2.2)

l_{t+1}= \alpha \frac{y_{t+1}}{s_{t+1}}+ \left( 1- \alpha \right) \left( l_{t} \right) \quad (eq. 2.3)

s_{t+m+1}= \zeta \frac{y_{t+1}}{l_{t+1}}+ \left( 1- \zeta \right) s_{t+1} \quad (eq. 2.4)

\widehat{\sigma}_{t+1}= \sigma \widehat{y}_{t+1}^{ \tau}+ \xi \quad (eq. 2.5)

Additional Notations

s_{t}

seasonality factor at time t

m

number of seasons in the data (e.g. 12 for monthly, 4 for quarterly)

Additional Parameters

\zeta

smoothing parameter for the seasonality terms

S2GT (Double Seasonal, Global Trend)

S2GT is designed as an extension to SGT for time series data which exhibit two seasonality patterns.

Model Equations

y_{t+1} \sim Student \left( \nu,\widehat{y}_{t+1}, \sigma _{t+1} \right) \quad (eq. 3.1)

\widehat{y}_{t+1}=\left( l_{t}+ \gamma l_{t}^{ \rho } \right) s_{t+1}w_{t+1} \quad (eq. 3.2)

l_{t}= \alpha \frac{y_{t}}{s_{t}w_{t}}+ \left( 1- \alpha \right) \left( l_{t-1} \right) \quad (eq. 3.3)

s_{t+m}= \zeta \frac{y_{t}}{l_{t}w_{t}}+ \left( 1- \zeta \right) s_{t} \quad (eq. 3.4)

w_{t+d}= \delta \frac{y_{t}}{l_{t}s_{t}}+ \left( 1- \delta \right) w_{t} \quad (eq. 3.5)

\widehat{\sigma} _{t+1}= \sigma y_{t+1}^{ \tau}+ \xi \quad (eq. 3.6)

Additional Notations

w_{t}

second seasonality factor prevailing at time t

d

number of (second) seasons in a complete period (e.g. 12 for monthly, 4 for quarterly)

Additional Parameters

\delta

smoothing parameters for the second seasonality factors

NA

The best way to get started with the package is to have a look at the vignettes and the various demos that ship with the package. There is a vignette with examples of how to use the various methods included in the package, and a vignette that discusses some of the theoretical background.

As to the demos, you can find their source code in the "demo" subfolder in the package sources (available on CRAN). There are some basic demos and other more advanced ones that run on subsets of the M3 dataset and run potentially for hours.

The package contains models for seasonal and non-seasonal data, allows for external regressors, and different error distributions. In the following, we briefly also present some of the theoretical background of the methods.

Author(s)

Maintainer: Christoph Bergmeir christoph.bergmeir@monash.edu

Authors:

Other contributors:

  • Trustees of Columbia University (tools/make_cpp.R, R/stanmodels.R) [copyright holder]

See Also

Useful links:


Rlgt documentation built on Sept. 11, 2024, 7:49 p.m.