Description Usage Arguments Details Value References See Also Examples
This function fits vector exponential smoothing on the base level and optionally on higher levels of temporal aggregation for a multivariate xts timeseries object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | thief_vets(
y,
multi_freq = 12,
k = 1,
level = "grouped",
slope = "none",
damped = "none",
seasonal = "common",
lambda = NULL,
dependence = "equicorrelation",
frequency = 52,
horizon = NULL,
cores = parallel::detectCores() - 1,
group = NULL,
xreg = NULL,
max_agg = NULL,
xreg_include = NULL,
newxreg = NULL,
save_plots = FALSE,
fig_path = "",
discrete = FALSE
)
|
y |
|
multi_freq |
|
k |
|
level |
|
slope |
|
damped |
|
seasonal |
|
lambda |
|
dependence |
|
frequency |
|
horizon |
|
cores |
|
group |
Optional |
xreg |
Optional |
max_agg |
(optional) |
xreg_include |
optional |
newxreg |
Optional |
save_plots |
Logical. Plots of fitted and residual values for the unaggregated series will be saved to
|
fig_path |
|
discrete |
|
Series in y
are aggregated at all possible levels up to annual using tsaggregates
.
estimate.tsvets.spec
is used on the unaggregated (original series), and optionally on higher levels
of aggregation down to a frequency of multi_freq
. At frequencies below multi_freq
, the best-fitting
univariate model is chosen using automatic ensembles in ensemble_base
. Forecasts are reconciled
using reconcilethief
and are optionally constrained using non-negative optimisation if lambda
is provided. Adjustments to the original unaggregated forecast are incorporated and a distribution of 1000
sample
paths for each series' forecast are returned
A list
containing the reconciled forecast distributions for each series in y
. Each element in
the list
is a horizon x 1000 matrix
of forecast predictions
Athanasopoulos, G and de Silva, A. (2012),Multivariate Exponential Smoothing for Forecasting Tourist Arrivals,
Journal of Travel Research 51(5) 640–652.
de Silva, A., R. Hyndman, and R. D. Snyder. (2010).The Vector Innovations Structural Time Series Framework: A Simple Approach
to Multivariate Forecasting, Statistical Modelling (10) 353–74.
Athanasopoulos, G., Hyndman, R., Kourentzes, N., and Petropoulos, F. Forecasting with temporal hierarchies.
(2017) European Journal of Operational Research 262(1) 60–74
vets_modelspec
, ets_modelspec
, ensemble_base
,
reconcilethief
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | library(mvforecast)
data("ixodes_vets_dat")
# View the returned data
head(ixodes_vets_dat$y_train)
head(ixodes_vets_dat$xreg_train)
ixodes_vets_dat$xreg_include
head(ixodes_vets_dat$future_xreg)
# Fit a vets model with no regressors and common seasonality with the tsvets package
mod1 <- tsvets:::simulate.tsvets.estimate(tsvets:::estimate.tsvets.spec(tsvets:::vets_modelspec(ixodes_vets_dat$y_train,
level = "grouped",
slope = "none",
damped = "none",
seasonal = "common",
lambda = 1,
dependence = "equicorrelation",
frequency = 52,
cores = parallel::detectCores() - 1,
group = ixodes_vets_dat$groups),
solver = "solnp",
control = list(trace = 0)),
nsim = 1000,
h = ixodes_vets_dat$h)
# Calculate a summary of the summed out-of-sample CRPS
calc_crps(simulation = mod1, y_test = ixodes_vets_dat$y_test)
# Explore whether reconciliation of temporal hierarchies improves predictions
mod2 <- thief_vets(y = ixodes_vets_dat$y_train,
multi_freq = 12,
level = "grouped",
slope = "none",
damped = "none",
seasonal = "common",
lambda = 1,
dependence = "equicorrelation",
frequency = 52,
cores = parallel::detectCores() - 1,
group = ixodes_vets_dat$groups,
save_plots = FALSE)
calc_crps(simulation = mod2, y_test = ixodes_vets_dat$y_test)
# Plot one of the forecasts against the true values in the test set
plot_mvforecast(simulation = mod2[[4]])
points(as.vector(ixodes_vets_dat$y_test[,4]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.