| forecast.msarima | R Documentation |
Returns forecasts and prediction intervals for a fitted multi-seasonal ARIMA model.
## S3 method for class 'msarima'
forecast(object, h = 10, level = c(80, 95), fan = FALSE, ...)
object |
An object of class |
h |
Number of periods to forecast. Default is 10. |
level |
Confidence levels for the prediction intervals, in percent.
Default is |
fan |
If |
... |
Additional arguments (currently not used). |
Point forecasts are computed by running the model recursion forward, setting the future innovations to zero. Differencing and the constant term, when present, are taken from the fitted model, so the forecasts are on the scale of the original series.
Prediction intervals assume Gaussian innovations. The forecast variance
V_h is obtained from the MA(\infty) representation of the model.
An object of class "forecast" containing the following elements:
method |
The name of the forecasting method (same as |
model |
The fitted |
level |
The confidence levels for prediction intervals (as percentages). |
mean |
Point forecasts as a time series (ts or msts object). |
lower |
Lower limits for prediction intervals. Matrix with one column for each
confidence level specified in |
upper |
Upper limits for prediction intervals. Matrix with one column for each
confidence level specified in |
x |
The original time series. |
series |
The name of the series. |
fitted |
Fitted values from the model. |
residuals |
Residuals from the model. |
msarima, simulate.msarima
# Simulate and fit model
set.seed(123)
y <- msarima.sim(nsim = 200,
order = c(1, 0, 0),
seasonal = list(c(1, 0, 0), c(0, 0, 1)),
seasonal.period = c(4, 11),
ar = c(0.5, 0.5), ma = 0.3, sigma2 = 1)
fit <- msarima(y, order = c(1, 0, 0),
seasonal = list(c(1, 0, 0), c(0, 0, 1)),
seasonal.period = c(4, 11))
# Forecast 20 steps ahead with default confidence levels (80%, 95%)
fc <- forecast(fit, h = 20)
print(fc)
# Forecast with custom prediction intervals
fc2 <- forecast(fit, h = 20, level = c(90, 95, 99))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.