Are Interest Rates Autocorrelated?
When you look at daily changes in interest rates, the autocorrelation is close to zero. However, if you resample the data and look at annual changes, the autocorrelation is negative. This implies that while short term changes in interest rates may be uncorrelated, long term changes in interest rates are negatively autocorrelated. A daily move up or down in interest rates is unlikely to tell you anything about interest rates tomorrow, but a move in interest rates over a year can tell you something about where interest rates are going over the next year. And this makes some economic sense: over long horizons, when interest rates go up, the economy tends to slow down, which consequently causes interest rates to fall, and vice versa.
The DataFrame daily_rates
contains daily data of 10-year interest rates from 1962 to 2017.
This exercise is part of the course
Time Series Analysis in Python
Exercise instructions
- Create a new DataFrame,
daily_diff
, of changes in daily rates using the.diff()
method. - Compute the autocorrelation of the column
'US10Y'
indaily_diff
using the.autocorr()
method. - Use the
.resample()
method with the argumentrule='A'
followed by the function.last()
to convert to annual frequency. - Create a new DataFrame,
yearly_diff
of changes in annual rates and compute the autocorrelation, as above.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Compute the daily change in interest rates
daily_diff = daily_rates.___
# Compute and print the autocorrelation of daily changes
autocorrelation_daily = daily_diff[___].___
print("The autocorrelation of daily interest rate changes is %4.2f" %(autocorrelation_daily))
# Convert the daily data to annual data
yearly_rates = daily_rates.resample(___).___
# Repeat above for annual data
yearly_diff = yearly_rates.___
autocorrelation_yearly = yearly_diff[___].___
print("The autocorrelation of annual interest rate changes is %4.2f" %(autocorrelation_yearly))