basicf | R Documentation |
Basic forecasting functions for multivariate time series
basicf(
y,
h = 5,
level = 95,
method = c("mean", "median", "rw"),
type_pi = c("gaussian", "bootstrap", "blockbootstrap", "movingblockbootstrap"),
block_length = NULL,
seed = 1,
B = 100,
show_progress = TRUE
)
y |
A multivariate time series of class |
h |
Forecasting horizon |
level |
Confidence level for prediction intervals |
method |
forecasting method, either "mean", "median", or random walk ("rw") |
type_pi |
type of prediction interval currently, "gaussian", "bootstrap", "blockbootstrap" or "movingblockbootstrap" |
block_length |
length of block for (circular) "blockbootstrap" or "movingblockbootstrap" |
seed |
reproducibility seed for |
B |
Number of bootstrap replications for |
show_progress |
A boolean; show progress bar for bootstrapping? Default is TRUE. |
An object of class "mtsforecast"; a list containing the following elements:
method |
The name of the forecasting method as a character string |
mean |
Point forecasts for the time series |
lower |
Lower bound for prediction interval |
upper |
Upper bound for prediction interval |
sims |
Model simulations for bootstrapping (basic, or block) |
x |
The original time series |
residuals |
Residuals from the fitted model |
coefficients |
Regression coefficients for |
require(fpp)
res <- ahead::basicf(fpp::insurance, h=10)
par(mfrow=c(1, 2))
plot(res, "TV.advert")
plot(res, "Quotes")
res <- ahead::basicf(fpp::insurance, method="rw", h=10)
par(mfrow=c(1, 2))
plot(res, "TV.advert")
plot(res, "Quotes")
# block bootstrap
res3 <- ahead::basicf(fpp::insurance, h=10, type_pi = "bootstrap", B=10)
res5 <- ahead::basicf(fpp::insurance, h=10, type_pi = "blockbootstrap", B=10,
block_length = 4)
print(res3$sims[[2]])
print(res5$sims[[2]])
par(mfrow=c(2, 2))
plot(res3, "Quotes")
plot(res3, "TV.advert")
plot(res5, "Quotes")
plot(res5, "TV.advert")
# moving block bootstrap
res6 <- ahead::basicf(fpp::insurance, h=10,
type_pi = "movingblockbootstrap", B=10,
block_length = 4, method = "rw")
par(mfrow=c(1, 2))
plot(res6, "Quotes")
plot(res6, "TV.advert")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.