theta {tsutils}R Documentation

Theta method

Description

Estimate Theta method.

Forecast with fitted Theta method.

Produce a plot of the fitted Theta method.

Usage

theta(
  y,
  m = NULL,
  sign.level = 0.05,
  cost0 = c("MSE", "MdSE", "MAE", "MdAE"),
  cost2 = c("MSE", "MdSE", "MAE", "MdAE"),
  costs = c("MSE", "MdSE", "MAE", "MdAE"),
  multiplicative = c("multiplicative", "additive", "auto"),
  cma = NULL,
  outliers = NULL
)

## S3 method for class 'theta'
forecast(object, h = NULL, ...)

## S3 method for class 'theta'
plot(x, thetalines = c(TRUE, FALSE), ...)

theta.thief(y, h = NULL, ...)

Arguments

y

input time series. Can be ts object.

m

seasonal period. If y is a ts object then the default is its frequency.

sign.level

significance level for trend and seasonality tests.

cost0

cost function of theta0 line. Can be:

  • "MSE": mean squared error.

  • "MdSE": median squared error.

  • "MAE": mean absolute error.

  • "MdAE": median absolute error.

cost2

cost function of theta2 line. Same options as cost0.

costs

cost function of seasonal element. Same options as cost0.

multiplicative

type of seasonal decomposition. This can be "multiplicative", "additive" or "auto". If y contains non-positive values then this is forced to "additive".

cma

input precalculated level/trend for the analysis. Use NULL to estimate internally.

outliers

provide vector of location of observations that are considered outliers (see residout). These will be considered in the estimation of theta0. For no outliers use NULL.

object

object of class theta.

h

forecast horizon. If h is NULL, then the horizon is set equal to the the seasonal frequency.

...

additional arguments passed to functions.

x

object of class theta.

thetalines

if TRUE, then theta lines are included in the plot.

Details

This implementation of the Theta method tests automatically for seasonality and trend. Seasonal decomposition can be done either additively or multiplicatively and the seasonality is treated as a pure seasonal model. The various Theta components can be optimised using different cost functions. The originally proposed Theta method always assumed multiplicative seasonality and presence of trend, while all theta lines were optimised using MSE and seasonality was estimated using classical decomposition.

Value

An object of class theta, containing:

Functions

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com.

References

Examples

fit <- theta(referrals)
plot(fit)

forecast.theta(fit,h=12) # Or simply use forecast(fit)

## Not run: 
library(thief)
thief(referrals,forecastfunction=theta.thief)

## End(Not run)


[Package tsutils version 0.9.4 Index]