theta | R Documentation |
Estimate Theta method.
Forecast with fitted Theta method.
Produce a plot of the fitted Theta method.
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, ...)
y |
input time series. Can be |
m |
seasonal period. If |
sign.level |
significance level for trend and seasonality tests. |
cost0 |
cost function of theta0 line. Can be:
|
cost2 |
cost function of theta2 line. Same options as |
costs |
cost function of seasonal element. Same options as |
multiplicative |
type of seasonal decomposition. This can be |
cma |
input precalculated level/trend for the analysis. Use |
outliers |
provide vector of location of observations that are considered outliers (see |
object |
object of class |
h |
forecast horizon. If |
... |
additional arguments passed to functions. |
x |
object of class |
thetalines |
if |
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.
An object of class theta
, containing:
"method"
: "Theta".
"y"
: the input time series.
"m"
: seasonal periods.
"exist"
: Statistical testing results, exist[1]
is the result for trend, exist[2]
is for season.
"multiplicative"
: If TRUE
, then seasonality is modelled multiplicatively.
"theta0"
: fitted theta0 line values.
"theta2"
: fitted theta2 line values.
"season"
: fitted season values.
"x.out"
: modelled outliers.
"cost"
: cost functions for theta0, theta2 and season components.
"a"
: SES parameters of theta2.
"b"
: regression parameters of theta0.
"p"
: coefficients of outliers from theta0 and theta2 estimation.
"g"
: pure seasonal exponential smoothing parameters.
"fitted"
: fitted values.
"residuals"
: in-sample residuals.
"MSE"
: in-sample Mean Squared Error.
theta.thief()
: Wrapper function to use Theta with thief
.
Nikolaos Kourentzes, nikolaos@kourentzes.com.
The original Theta method was proposed by: Assimakopoulos, V., & Nikolopoulos, K. (2000). The theta model: a decomposition approach to forecasting. International journal of forecasting, 16(4), 521-530. See details in how the implementation here differs.
The THieF forecasting methodology used for theta.thief
is proposed by: Athanasopoulos, G., Hyndman, R. J., Kourentzes, N., & Petropoulos, F. (2017). Forecasting with temporal hierarchies. European Journal of Operational Research, 262(1), 60-74.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.