Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

VAR Example Fed

by Professor Throckmorton
for Time Series Econometrics
W&M ECON 408/PUBP 616

Summary

  • Christiano et al. (2005): Christiano, Eichenbaum, and Evans “Nominal Rigidities and the Dynamic Effects of a Shock to Monetary Policy” (Journal of Polical Economy, 2005) has over 9,000 citations (astronomical!) according to google scholar.

  • Let Yt\mathbf{Y}_t denote variables observed between 1965Q3 to 1995Q3,

    Yt=[Y1t,Rt,Y2t]\begin{gather*} \mathbf{Y}_t = [\mathbf{Y}_{1t}, R_t, \mathbf{Y}_{2t}]' \end{gather*}

    Y1t\mathbf{Y}_{1t}: real GDP, real consumption, GDP deflator, real investment, real wages, and labor productivity

    RtR_t: federal funds rate

    Y2t\mathbf{Y}_{2t}: real profits, M2 growth rate

Assumptions

  • RtR_t appears after Y1t\mathbf{Y}_{1t}, i.e., the assumption is that none of the variables in Y1t\mathbf{Y}_{1t} respond contemporaneously to RtR_t, so the real economy lags behind monetary policy (citing Friedman)

  • “All these variables, except money growth, have been natural logged.”

  • “With one exception (the growth rate of money), all the variables in are included in levels.”

  • “The VAR contains four lags of each variable, and the sample period is 1965:3–1995:3.”

Read Data

# Libraries
from fredapi import Fred
import pandas as pd
# Setup acccess to FRED
fred_api_key = pd.read_csv('fred_api_key.txt', header=None)
fred = Fred(api_key=fred_api_key.iloc[0,0])
# Series to get
series = ['GDP','PCE','GDPDEF','GPDI','COMPRNFB','OPHNFB','FEDFUNDS','CP','M2SL']
rename = ['gdp','cons','price','inv','wage','prod','ffr','profit','money']
# Get and append data to list
dl = []
for idx, string in enumerate(series):
    var = fred.get_series(string).to_frame(name=rename[idx])
    dl.append(var)
    print(var.head(2)); print(var.tail(2))
            gdp
1946-01-01  NaN
1946-04-01  NaN
                  gdp
2025-01-01  29962.047
2025-04-01  30331.117
             cons
1959-01-01  306.1
1959-02-01  309.6
               cons
2025-05-01  20615.2
2025-06-01  20685.2
             price
1947-01-01  11.141
1947-04-01  11.299
              price
2025-01-01  127.429
2025-04-01  128.059
            inv
1939-01-01  NaN
1939-04-01  NaN
                 inv
2025-01-01  5595.694
2025-04-01  5372.966
              wage
1947-01-01  34.386
1947-04-01  34.670
               wage
2024-10-01  108.178
2025-01-01  108.496
              prod
1947-01-01  22.256
1947-04-01  22.762
               prod
2024-10-01  115.725
2025-01-01  115.303
             ffr
1954-07-01  0.80
1954-08-01  1.22
             ffr
2025-05-01  4.33
2025-06-01  4.33
            profit
1946-01-01     NaN
1946-04-01     NaN
              profit
2024-10-01  3631.383
2025-01-01  3602.551
            money
1959-01-01  286.6
1959-02-01  287.7
              money
2025-05-01  21883.6
2025-06-01  22020.8
# Concatenate data to create data frame (time-series table)
raw = pd.concat(dl, axis=1).sort_index()
# Resample/reindex to quarterly frequency
raw = raw.resample('QE').last().dropna()
# Display dataframe
display(raw)
Loading...

Transform Data

# Scientific computing
import numpy as np
data = pd.DataFrame()
# log real GDP
data['gdp'] = 100*(np.log(raw['gdp']/raw['price']))
# log real Consumption
data['cons'] = 100*(np.log(raw['cons']/raw['price']))
# log price level
data['price'] = 100*np.log(raw['price'])
# log real Investment
data['inv'] = 100*(np.log(raw['inv']/raw['price']))
# log real Wage
data['wage'] = 100*(np.log(raw['wage']/raw['price']))
# log labor productivity
data['prod'] = 100*np.log(raw['prod'])
# log federal funds rate
data['ffr'] = 100*np.log(raw['ffr'])
# log real Profits
data['profit'] = 100*(np.log(raw['profit']/raw['price']))
# M2 growth rate
data['money'] = 100*(raw['money']/raw['money'].shift(1)-1)
# Christiano et al. (2005) sample
sample = data['09-30-1965':'09-30-1995']
display(sample)
Loading...

Non-stationarity

# Plotting
import matplotlib.pyplot as plt
# Plot GDP
fig, ax = plt.subplots(figsize=(6.5,2.5))
ax.plot(sample['gdp'])
ax.set_title('100 log(Real GDP)')
ax.grid()
<Figure size 650x250 with 1 Axes>
  • Q: Do these transformations make the data stationary? A: Clearly not.

  • Sims et al. (1990) find that VARs in levels can yield consistent impulse response functions even if the variables are non-stationary, I(1), and cointegrated.

  • Fortunately, Christiano et al. (2005) is only concerned with estimating IRFs.

Cointegration

  • Suppose you have two non-stationary time series: yty_t and xtx_t, both I(1).

  • Typically, any linear combination of them, zt=ytβxtz_t = y_t - \beta x_t, would also be non-stationary.

  • But if some linear combination is stationary, then the variables are cointegrated.

  • The coefficients (like [1,β][1, -\beta]) form a cointegrating vector.

  • This implies the variables share a stable long-run relationship despite short-run fluctuations.

Example

  • Let yty_t be log(GDP)\log(GDP) (i.e., income) and xtx_t be log(PCE)\log(PCE) (i.e., consumption)

  • Both series are non-stationary, I(1), because they have a stochastic time trend.

  • There might exist a linear combination zt=ytβxtz_t = y_t - \beta x_t that is stationary, I(0), meaning

    • Income and consumption have a long-run linear relationship, i.e., they are cointegrated.

    • Deviations from the long-run are mean-reverting.

Estimation

# VAR model
from statsmodels.tsa.api import VAR
# make the VAR model
model = VAR(sample)
# Estimate VAR(4)
results = model.fit(4)
# Assign impulse response functions (IRFs)
irf = results.irf(20)
# Plot IRFs
plt = irf.plot(orth=True,impulse='ffr',figsize=(6.5,22.5));
plt.suptitle('');
<Figure size 650x2250 with 9 Axes>
References
  1. Christiano, L. J., Eichenbaum, M., & Evans, C. L. (2005). Nominal Rigidities and the Dynamic Effects of a Shock to Monetary Policy. Journal of Political Economy, 113(1), 1–45. https://doi.org/10.1086/426038
  2. Sims, C. A., Stock, J. H., & Watson, M. W. (1990). Inference in linear time series models with some unit roots. Econometrica, 113–144. 10.2307/2938337