fp.forecast {forecastLSW} | R Documentation |
Do automatic Box-Jenkins ARIMA fit and forecast.
Description
This function merely wraps some excellent functions from the forecast package up and returns the forecast values and their lower and upper prediction intervals.
Usage
fp.forecast(x, h = 1, conf.level = 95)
Arguments
x |
The time series you wish to forecast. |
h |
The number of steps ahead (forecast horizon) |
conf.level |
The confidence level for the forecast prediction interval expressed as a value between 0 and 100. |
Details
This function entirely relies on existing functions from
the forecast package. It applies auto.arima
to x
to fit an ARIMA model to the series with an automatic choice
of parameters. Then the forecast
function is applied
to the ARIMA object to obtain forecasts and prediction intervals.
Value
A matrix with h
rows and three columns. The first column
contains the forecasted values. The second and third columns
contrain the lower and upper prediction intervals.
Author(s)
G.P. Nason
References
Killick, R., Knight, M.I., Nason, G.P., Nunes M.A., Eckley I.A. (2023) Automatic Locally Stationary Time Series Forecasting with application to predicting U.K. Gross Value Added Time Series under sudden shocks caused by the COVID pandemic arXiv:2303.07772
Hyndman, R.J. and Khandakar, Y. (2008) Automatic Time Series Forecasting: The forecast package for R. Journal of Statistical Software, 27, Issue 3.
Examples
#
# Generate random test series
#
x.test <- tvar2sim()
#
# Produce stationary Box-Jenkins forecasts and prediction intervals for
# two-steps ahead
#
fp.forecast(x.test, h=2)