1.7.3 Updating the Forecast Another advantage of using the approximate forecast formula is that the forecast can be easily updated when new observations are available. From ( 7.7) the forecast error for the prediction is given by . And the difference en(h+1)-en+1(h) is . Setting h=1, we get . So we have This is the desired formula for updating the forecast. That is, once Xn+1 is known, we know the actual forecast error en(1), and the forecast value for Xn+h+1 is modified by a quantity proportional to en(1). Equation ( 7.10) allows us to get the forecasts based on n+1 observations from the forecasts based on n observations. Note that the updating formula is for the approximate best linear predictor only.
As an exercise, let us try to write a program implementing ( 7.10). We want to find the forecasts {} of the time series given the model, the old forecast values {}, and the new available value Xn+1. The weights can be obtained by extracting the first argument of ToMAModel. A simple function that performs the updating can be written as follows. This defines a function to do the updating. Example 7.6 Here is an example using the function newforecast to update the forecast of the ARMA( 1, 1) model Xt=0.5Xt-1+Zt-0.7Zt-1. We first define the ARMA(1, 1) model to be model. This seeds the random number generator. This generates the time series data. Suppose that only the first 40 data points are available and we predict the next four points. Here is the prediction for the next four points based on 40 data points. Out[28]= | |
When the 41st data point is given, the prediction based on the 41 data points can be obtained from the old prediction using newforecast. Here is the prediction for X42, X43, and X44. Out[29]= | |
Note that the new forecast has a different lead time as well as forecast origin. Note also that the mean square forecast errors are not updated. They are given by ( 7.8) and remain the same independent of the forecast origin since they are the mean square forecast errors in the infinite sample case.
These updated forecast values are indeed the same as those had we done the forecast with 41 data points in the first place. This gives the prediction for the next three points based on 41 data points. Out[30]= | |
Example 7.7 Suppose more than one new observation is made available, we can recursively update the forecast using the Mathematica internal function Fold and newforecast defined above. Suppose initially we make a forecast of a lead time 10 based on n=40 data points and later 5 new data points are obtained. We can update our forecast based on the new available information as follows. (The same data and model as in Example 7.6 are used to illustrate this.) We denote the first 40 data points data0. We denote the next 5 data points newdata. Out[33]= | |
This updates the above prediction. Out[34]= | |
We get the same result using the forecast origin n=45. Out[35]= | |
|