Exercise

Estimate the autoregressive (AR) model

For a given time series x we can fit the autoregressive (AR) model using the arima() command and setting order equal to c(1, 0, 0). Note for reference that an AR model is an ARIMA(1, 0, 0) model.

In this exercise, you'll explore additional qualities of the AR model by practicing the arima() command on a simulated time series x as well as the AirPassengers data. This command allows you to identify the estimated slope (ar1), mean (intercept), and innovation variance (sigma^2) of the model.

Both xand the AirPassengers data are preloaded in your environment. The time series x is shown in the figure on the right.

Instructions

100 XP
  • Use arima() to fit the AR model to the series x. Closely examine the output from this command.
  • What are the slope (ar1), mean (intercept), and innovation variance (sigma^2) estimates from your previous command? Type them into your R workspace.
  • Now, fit the AR model to AirPassengers, saving the results as AR. Use print() to display the fitted model AR.
  • Finally, use the commands provided to plot the AirPassengers, calculate the fitted values, and add them to the figure.