Robert J. Hodrick and Tuomas Tomunen

3/26/2019

Introduction

In this notebook, we describe the sources and the construction of interest rate and exchange rate data used in "Taking the Cochrane-Piazzesi Term Structure Model Out of Sample: More Data, Additional Currencies, and FX Implications". Then, as a diagnostics test, we graphically compare our interest rate data to Wright (2011) data.

Data sources and constructing 1-5 year yields

  • All raw data can be found in data/raw_data
  • The raw data can be transformed to monthly 1-5 year yields by running create_datasets.m with Matlab (Financial Instruments Toolbox is required)
  • All yields in cleaned files are continuously compounded

Notes on individual data files

US

  • Source: Fama Bliss Data from CRSP via WRDS.
  • Raw data is not provided due to data lisencing reasons. Instead, user must run download() from data/create_us.py to reconstruct the raw data file.

UK

Germany

Switzerland

Canada

Japan

  • Source file: jp_au_nz_yields.xlsx
  • From 1/1985 to 8/2000, data is from Wright (2011).
  • Afterwards yields from series constructed by Thomson Reuters are used (Datastream, see file for series codes)

Australia

  • Source file: jp_au_nz_yields.xlsx
  • From 2/1987 to 2/2005, data is from Wright (2011).
  • Afterwards yields from series constructed by Thomson Reuters are used (Datastream, see file for series codes)

Sweden

Norway

New Zealand

  • Source file: jp_au_nz_yields.xlsx
  • From 1/1990 to 05/1996, data is from Wright (2011).
  • Afterwards yields from series constructed by Thomson Reuters are used (Datastream, see file for series codes)
    • Note that 4-year yield is missing
    • Ultimately, this data is not used in the analysis

Exchange rates

Wright data

Compare original Wright (2011) data to ours

In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

COUNTRY_CURRENCY_MAP = {'US': 'USD',
                        'UK': 'GBP',
                        'Germany': 'EUR',
                        'Switzerland': 'CHF',
                        'Canada': 'CAD',
                        'Japan': 'JPY',
                        'Australia': 'AUD',
                        'Sweden': 'SEK',
                        'Norway': 'NOK',
                        'New Zealand': 'NZD'}
   
# Wright (2011) data
wright_data = {}
for i in COUNTRY_CURRENCY_MAP.keys():
    wright_df = pd.read_excel('raw_data/ZCdata.xls', sheet_name=i, header=1).reset_index()
    wright_df['date'] = pd.to_datetime(wright_df['level_0']*10000+wright_df['level_1']*100+1, format='%Y%m%d') + pd.offsets.MonthEnd(0)
    wright_df = wright_df.set_index('date')
    wright_data[i] = wright_df[[12, 24, 36, 48, 60]]
    
# Own data
own_data = {}
for i, c in COUNTRY_CURRENCY_MAP.items():
    own_df = pd.read_csv('{}.csv'.format(c), parse_dates=['date'])
    own_df.columns = ['date', 12, 24, 36, 48, 60]
    own_data[i] = own_df.set_index('date')
In [2]:
fig, ax = plt.subplots(nrows=10, ncols=5, figsize=(60, 90))

fig.suptitle('Interest rate comparison between Wright data (orange) and our data (blue). Correlation in parentheses.', size=40)

plotrow = 0
for i in COUNTRY_CURRENCY_MAP.keys():
    wright_df = wright_data[i]
    own_df = own_data[i]
    for y in [1, 2, 3, 4, 5]:
        corr = np.round(own_df[[(y*12)]].merge(wright_df[[(y*12)]], left_index=True, right_index=True, validate='1:1').corr().iloc[0, 1], 4)
        ax[plotrow, (y-1)].plot(own_df.index, own_df[(y*12)])
        ax[plotrow, (y-1)].plot(wright_df.index, wright_df[y*12])
        ax[plotrow, (y-1)].set_title('{} {}-year ({})'.format(i, y, corr), size=30)
        ax[plotrow, (y-1)].tick_params(axis='both', which='major', labelsize=20)
    plotrow = plotrow + 1
    
plt.show()
In [ ]: