forecTheta (version 1.0)

forecast: Optimised Theta Method

Description

These functions performs the forecasting of univariate time series using the Optimised Theta Method or Standard Theta Method. If the theta parameter is not specified so the Generalised Rolling Origin Evaluation is used for select the theta value over the thetaList argument.

Usage

otm(y, h=5, seasonal=NULL, theta=NULL,
	g="sAPE", n1=length(y)-h, m=floor(h/2), H=h, p=1+floor((length(y)-n1)/m),
	thetaList=seq(from=1,to=5,by=0.5), tLineExtrap=ses, mc.cores=1, ...)
	
	thetaM(y, h=5, seasonal=NULL)

Arguments

y
Object of time series class
h
Number of required forecasting periods
seasonal
If TRUE, the multiplicative seasonal decomposition is used. If NULL, quarterly and monthly time series are tested for statistically seasonal behaviour, with 95% of significance. Default is NULL.
theta
The value of theta parameter. If theta = NULL the theta parameter is estimated using the Generalised Rolling Origin Evaluation.
g
The error type that will be used by groe function for select the theta value in estimation process. The possibility values for g is "sAPE", "APE", "AE" and "SE". If theta
n1
The first origin for Generalised Rolling Origin Evaluation. This argument is not used if theta argument is not NULL.
m
The number of movements of the origin in each step. This argument is not used if theta argument is not NULL.
H
The number of predictions in each step. This argument is not used if theta argument is not NULL.
p
The number of origin updates. This argument is not used if theta argument is not NULL. Default is the maximum, i.e., p=1+floor((length(y)-n1)/m).
thetaList
A vector with the possible values for theta. This argument is not used if theta argument is not NULL.
tLineExtrap
A forecasting function for extrapolation the second theta-line. Default is ses.
mc.cores
Number of cores that will be used for estimate the theta parameter. It is not accepted mc.cores > 1 on Windows SO.
...
Additional arguments for tLineExtrap.

Value

  • A list containing the elements:
  • meanA time series element with the forecasting points.
  • fittedA time series element with the fitted points.
  • residualsA time series element with the residual points.
  • thetaThe estimated theta value.
  • weightsThe estimated weights values.

Details

These functions are fully automatic, you just need to pass your time series. Particular cases are obtainer by: If theta = 1 the tLineExtrapModel method is computed. If theta = 2 so the Standard Theta Method of Assimakopoulos and Nikolopoulos (2000) is computed.

References

Fioruci J.A., Pellegrini T.R., Louzada F., Petropoulos F. (2015). The Optimised Theta Method. Free available at http://arxiv.org/abs/1503.03529. Assimakopoulos, V. and Nikolopoulos k. (2000). The theta model: a decomposition approach to forecasting. International Journal of Forecasting 16, 4, 521-530.

See Also

forecTheta-package, groe, forecast, ses

Examples

Run this code
y1 = 2+ 0.15*(1:20) + rnorm(20,2)
y2 = y1[20]+ 0.3*(1:30) + rnorm(30,2)
y =  as.ts(c(y1,y2))

otm.fit <- otm(y=as.ts(y[1:40]), h=10)
plot(y)
points(otm.fit$fitted, type = "l")
points(otm.fit$mean, type = "l", col="blue")

Run the code above in your browser using DataLab