Session Ready
Exercise

Let's Forecast Interest Rates

You will now use the forecasting techniques you learned in the last exercise and apply it to real data rather than simulated data. You will revisit a dataset from the first chapter: the annual data of 10-year interest rates going back 56 years, which is in a Series called interest_rate_data. Being able to forecast interest rates is of enormous importance, not only for bond investors but also for individuals like new homeowners who must decide between fixed and floating rate mortgages.

You saw in the first chapter that there is some mean reversion in interest rates over long horizons. In other words, when interest rates are high, they tend to drop and when they are low, they tend to rise over time. Currently they are below long-term rates, so they are expected to rise, but an AR model attempts to quantify how much they are expected to rise.

Instructions
100 XP
  • Import the class ARMA in the module statsmodels.tsa.arima_model.
  • Create an instance of the ARMA class called mod using the annual interest rate data and choosing the order for an AR(1) model.
  • Fit the model mod using the method .fit() and save it in a results object called res.
  • Plot the in-sample and out-of-sample forecasts of the data using the .plot_predict() method.
    • Pass the arguments start=0 to start the in-sample forecast from the beginning, and choose end to be '2022' to forecast several years in the future.
    • Note that the end argument 2022 must be in quotes here since it represents a date and not an integer position.