AR model estimation and forecasting
1. AR model estimation and forecasting
Let's try applying the AR model to some time series data.2. AR processes: inflation rate
Consider the one-month US inflation rate. It's available in the Mishkin data in the Ecdat package. The rate is annualized and reported in percent with monthly observations from 1950 through 1990. The one-month inflation rate is the first column in the the Mishkin data. You can extract the first column, apply as-dot-ts() to convert it to a time series object, and assign the result to the variable inflation. Next, you can plot the time series and its sample ACF using the tsplot() and acf() commands as you did in earlier chapters. From the time series plot you see that the inflation series is usually positively-valued, and it is fairly persistent, with an extended period of high inflation beginning in the 1970s. From the ACF plot you see strong, positive, but decaying autocorrelation estimates from lags 1 through 24. The AR model may provide a good fit to these data.3. AR model: inflation rate
Recall the AR model you are about to fit in the displayed equation. To proceed, you apply the arima() function to the series inflation. Within the larger class of ARIMA models you specify order = c(1,0,0) to indicate a first-order AR model. The fitted model is assigned to AR_inflation, then the print() function is applied to AR_inflation to display a summary of the fitted model. From the output, you can find the estimates of phi, mu and sigma^2_epsilon are, 0-point-596, 3-point-9745, and 9-point-713, respectively. In general, note that ar1 refers to the estimate of the slope parameter phi, intercept refers to the estimate of the mean parameter mu, and sigma^2 refers to the estimate of the innovation variance. Approximate standard errors for phi-hat and mu-hat appear below the coefficient estimates in the line labeled se.4. AR processes: fitted values - I
Next, you can examine the fitted AR model. The top equations define fitted values Y-hat for the AR model. These are estimates of today given yesterday. The bottom equations are the usual definition of residuals, that is, today minus the estimate for today, or observed values minus fitted values. The residuals are denoted here as epsilon-hat. They are estimates of the white noise.5. AR processes: fitted values - II
First, you can plot the inflation series inflation. Next, since the model object AR_inflation contains the residuals, you can use those to find the fitted values. The residuals() function is applied to extract the residuals from AR_inflation. From the last equation, you can see that the fitted values are equal to the observations minus the residuals. Now that the fitted values are computed, you can add them to the figure using the points() function. In this case, specify a red, dashed line to depict the fitted values series. It looks like there is a close relationship between the fitted values Y-hat and the data series Y. The AR model explains a lot of the variation observed in the inflation series. More advanced models may offer an improvement, but a simple model does fairly well in this example.6. Forecasting
Finally, you can use the predict() function to make model-based forecasts from the last observation of the inflation series. The prediction for January 1991 is about 1-point-6 percent, with a standard error of about 3-point-1.7. Forecasting (cont.)
To forecast 6 months ahead you should utilize the additional argument n-dot-ahead equals 6. This produces 1-step through 6-step forecasts. It appears the 6 month ahead forecast is about 3-point-8, based on the fitted AR model.8. Let's practice!
That was a lot, great job! Now you try estimating and forecasting an AR model.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.