Computes forecasts for the finite distributed lag models, autoregressive distributed lag models, Koyck transformation of distributed lag models, and polynomial distributed lag models.
forecast(model , x , h =1, interval =FALSE, level =0.95, nSim =500)
Arguments
model: A fitted model by one of dlm(), koyckDlm(), ployDlm() or ardlDlm functions.
x: A vector or matrix including the new observations of independent time series. This is not restricted to ts objects. Please see the details for construction of this argument.
h: The number of ahead forecasts.
interval: If TRUE, (1−α)% prediction intervals for forecasts are displayed along with forecasts.
level: Confidence level of prediction interval.
nSim: An integer showing the number of Monte Carlo simulations used to compute prediction intervals for forecasts.
Details
This function directly uses the model formula and estimates of model coefficients to find forecast one-by-one starting from the one-step ahead forecast.
Prediction intervals are found by the Monte Carlo approach using a Gaussian error distribution with zero mean and empirical variance of the dependent series.
When the model argument includes multiple independent series, x must be entered as a matrix including the new observations of each independent series in its rows. The number of columns of x must be equal to the forecast horizon h and the rows of x must match with the independent series in the order they appear in the data.
When x and y are used to fit the model and some elements of the model are removed, you must use model and formula instead of x and y to fit the model and send the new data as a matrix into the forecast() function.
This function can still be used when some of the lags of independent series are removed from the model.