Description Usage Arguments Value Author(s) Examples
Take fitted ARIMA model and forecast future values. If the realization of future values are given, it also computes prediction diagnostics. For prediction, it supports two methods: One-shot prediction predicts all future values only using the given model. One-step prediction predicts one step ahead and refit the model with the realized future value for the next prediction. As noticed, for one-step prediction user must provide realized future values.
1 2 3 4 5 6 7 8 |
fit |
Fitted ARIMA model( |
ndays |
The number of days to be forecasted. (default = 30) |
method |
Method of prediction.
Should be one of |
... |
Extra parameters for SARIMA fitting.
Refer to |
real |
Realizations of future values.
This parameter is mandatory for one-step forecasting, while it is only optional for one-shot forecasting.
Also, for one-step forecasting, the number of realized future values must be greater than |
plot |
If |
A list containing the following elements:
mean | Predicted future values. |
CI | Data frame holding lower and upper bounds of 80% and 95% CI. |
statistics | A numeric vector holding prediction diagnostics,
RMSE(Root Mean Square Error) and MAE(Mean Absolute Error).
If the number of predicted future values and the number of given future realizations differ,
it just ignores extra information in the longer one. (Returned only if real is given.) |
plot | ggplot object of the plot. (Returned only if plot is TRUE.) |
Sanghyun Park, Daun Jeong, and Sehun Kim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # 228 is the station code for SNU
# We want to predict the last 100 total count of passengers
data <- get.subway(228)
obs <- data$total[1:(nrow(data) - 100)]
real <- data$total[(nrow(data) - 99):nrow(data)]
# Fit SARIMA model
fit <- auto.arima(ts(obs, frequency = 7))
# One-shot prediction
future(fit, ndays = 100, method = "one-shot", real = real)
# One-step prediction
future(fit, ndays = 100, method = "one-step", real = real)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.