title: VAR Models: Two Real Data ExamplesIn the last lecture, we discussed some simple physics examples where the VAR(2) model is motivated by basic physics. The estimate of the matrix told us which bodies were connected to which others. We also saw a real data example involving daily temperatures of Chicago and New York where the VAR models showed that Chicago weather is helpful for predicting New York weather in the near future, but New York weather is not helpful for predicting future Chicago weather.
In this lecture, we shall look at more real data applications of VAR modeling.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.tsa.api import VAR
np.set_printoptions(suppress = True) #this prints small numbers as 0.0006 instead of 6e-04
pd.set_option('display.width', 200) #this prevents tables with ten columns from being split over several lines
import warnings
warnings.filterwarnings("ignore") #this suppresses warnings from statsmodelsExample 1: Daily temperatures in ten cities¶
At the end of the last lecture, we fitted a VAR model to the daily temperatures in Chicago and New York, and found that the past of Chicago helps in predicting New York, but not the other way around. We now do the same thing with ten cities. The question is the one that we asked for the bodies connected by springs: which of the ten series are connected to each other, and in which direction? We shall answer it using only the temperature data.
The file DailyTemperature_TenCities_July2014_June2015.csv has the mean temperature (in degrees Fahrenheit) on each of the 365 days from 1 July 2014 to 30 June 2015 in ten cities, along with the normal temperature for each date in each city (this is the long-term average temperature for that date). The data are from the same source as in Lecture 22 (https://
temps = pd.read_csv("DailyTemperature_TenCities_July2014_June2015.csv", parse_dates = ['date'])
print("Number of days:", len(temps))
print(temps.iloc[:3, :5]) #first three days, and the columns for the first two cities
cities = ['Seattle', 'LosAngeles', 'Phoenix', 'Houston', 'Chicago', 'Indianapolis', 'Jacksonville', 'Charlotte', 'Philadelphia', 'NewYork']
labels = ['SEA', 'LA', 'PHX', 'HOU', 'CHI', 'IND', 'JAX', 'CLT', 'PHL', 'NYC'] #short labels for tables
k = len(cities)
#(latitude, longitude) of the weather stations, in degrees
location = {'Seattle': (47.45, -122.31), 'LosAngeles': (34.02, -118.29), 'Phoenix': (33.43, -112.01), 'Houston': (29.65, -95.28),
'Chicago': (41.79, -87.75), 'Indianapolis': (39.72, -86.29), 'Jacksonville': (30.49, -81.69), 'Charlotte': (35.21, -80.94),
'Philadelphia': (39.87, -75.24), 'NewYork': (40.78, -73.97)}
def distance_km(city1, city2):
#distance between two cities along the surface of the earth (the radius of the earth is 6371 km)
lat1, lon1 = np.radians(location[city1])
lat2, lon2 = np.radians(location[city2])
h = np.sin((lat2 - lat1) / 2) ** 2 + np.cos(lat1) * np.cos(lat2) * np.sin((lon2 - lon1) / 2) ** 2
return 2 * 6371 * np.arcsin(np.sqrt(h))Number of days: 365
date Seattle Seattle_normal LosAngeles LosAngeles_normal
0 2014-07-01 77 63.5 70 72.5
1 2014-07-02 70 63.5 70 72.5
2 2014-07-03 64 64.0 72 72.5
Here are the temperatures (black) and the normal temperatures (red) for three of the cities.
fig, ax = plt.subplots(3, 1, figsize = (12, 7), sharex = True)
for i, city in enumerate(['Seattle', 'Chicago', 'Jacksonville']):
ax[i].plot(temps['date'], temps[city], color = 'black', label = 'Temperature')
ax[i].plot(temps['date'], temps[city + '_normal'], color = 'red', label = 'Normal temperature for the date')
ax[i].set_ylabel(city + ' (degrees F)')
ax[0].legend()
plt.tight_layout()
plt.show()
As in the last lecture, we work with temperature anomalies instead of the daily temperatures. Let denote the temperature in city on day minus the normal temperature in city for that date.
#y_cities[t, i] is the temperature in city i on day t minus the normal temperature in city i for that date
y_cities = np.column_stack([temps[city] - temps[city + '_normal'] for city in cities])We fit the VAR(1) model to the ten series. There are ten equations with eleven coefficients each, so 110 coefficients are estimated from 364 days ( is the order selected by BIC). In the table below, the rows correspond to today, and the columns to yesterday.
print("Order selected by BIC =", VAR(y_cities).select_order(maxlags = 6).bic)
var1_cities = VAR(y_cities).fit(1)
A1_cities = var1_cities.coefs[0]
print("Estimate of the intercept:", np.round(var1_cities.intercept, 2))
print("Estimate of A1 (rows: today, columns: yesterday):")
print(pd.DataFrame(np.round(A1_cities, 2), index = cities, columns = labels))
stderr_A1 = var1_cities.stderr[1:] #standard errors of the entries of the estimate of A1
print("Smallest and largest standard errors of these estimates:", np.round(np.min(stderr_A1), 2), np.round(np.max(stderr_A1), 2))
print("Entries off the diagonal which are larger than 0.2 in absolute value (after rounding to two decimal places):")
for i in range(k):
for j in range(k):
if i != j and np.abs(np.round(A1_cities[i, j], 2)) > 0.2:
where = "below the diagonal" if i > j else "above the diagonal"
print(f"{cities[i]:>15} today, {cities[j]:>12} yesterday: {A1_cities[i, j]:5.2f} ({where})")Order selected by BIC = 1
Estimate of the intercept: [ 1.17 0.27 -0.26 -0.18 0.06 -0.21 1.37 1.97 1.21 1.21]
Estimate of A1 (rows: today, columns: yesterday):
SEA LA PHX HOU CHI IND JAX CLT PHL NYC
Seattle 0.72 0.05 -0.06 0.00 -0.04 0.07 0.02 -0.03 -0.01 -0.00
LosAngeles 0.09 0.81 -0.02 -0.01 -0.02 0.02 0.05 0.05 -0.10 0.04
Phoenix 0.06 0.25 0.68 -0.05 -0.05 0.06 -0.03 0.03 0.07 -0.07
Houston 0.05 -0.01 -0.00 0.61 0.13 0.03 -0.25 0.07 0.10 -0.16
Chicago -0.02 -0.08 0.01 0.04 0.86 -0.10 -0.15 0.02 0.03 -0.14
Indianapolis -0.03 -0.17 -0.02 0.02 0.46 0.42 -0.21 0.03 0.07 -0.20
Jacksonville -0.14 -0.12 -0.02 0.18 0.04 0.16 0.53 0.06 -0.15 0.01
Charlotte -0.05 -0.13 0.05 0.02 0.01 0.45 -0.03 0.41 -0.09 0.01
Philadelphia -0.01 -0.09 -0.04 -0.11 0.23 0.34 -0.07 -0.09 0.06 0.34
NewYork -0.08 -0.07 -0.10 -0.10 0.32 0.22 -0.09 -0.08 -0.20 0.59
Smallest and largest standard errors of these estimates: 0.03 0.15
Entries off the diagonal which are larger than 0.2 in absolute value (after rounding to two decimal places):
Phoenix today, LosAngeles yesterday: 0.25 (below the diagonal)
Houston today, Jacksonville yesterday: -0.25 (above the diagonal)
Indianapolis today, Chicago yesterday: 0.46 (below the diagonal)
Indianapolis today, Jacksonville yesterday: -0.21 (above the diagonal)
Charlotte today, Indianapolis yesterday: 0.45 (below the diagonal)
Philadelphia today, Chicago yesterday: 0.23 (below the diagonal)
Philadelphia today, Indianapolis yesterday: 0.34 (below the diagonal)
Philadelphia today, NewYork yesterday: 0.34 (above the diagonal)
NewYork today, Chicago yesterday: 0.32 (below the diagonal)
NewYork today, Indianapolis yesterday: 0.22 (below the diagonal)
Because the cities are ordered from west to east, the entries below the diagonal are the coefficients of cities to the west of the city whose equation it is, and the entries above the diagonal are the coefficients of cities to the east. Ten entries off the diagonal are larger than 0.2 in absolute value. Seven of them are positive and below the diagonal: a city tends to be warmer today if a city to its west was warmer yesterday. For example, the last row says that
(all the other terms have coefficients of at most 0.2 in absolute value). Of the three entries above the diagonal, one is the coefficient 0.34 of New York in the equation for Philadelphia. These two cities have nearly the same series, so the regression cannot tell which of the two matters (the coefficient of Philadelphia itself is only 0.06). The other two are negative.
So the matrix suggests that the connections go from west to east. We can also assess these connections by checking whether the past of city actually helps in predicting city .
For every pair of cities and , we compare two predictions of city : the prediction from its own past, and the prediction from its own past together with the past of city . We use the function prediction_rmse from Lecture 22 (it is copied below without any change). As in Lecture 22, the regressions are fitted using the days in 2014 (the first 184 days), the predictions are evaluated on the days in 2015 (the remaining 181 days), and . The table below gives the percentage change in the RMSE. Its rows correspond to the city which is predicted, and its columns to the city whose past is added. A negative entry means that the past of the city in the column helps.
def lagged(data, p):
#the columns are: 1, data at lag 1, ..., data at lag p
n = data.shape[0]
return np.column_stack([np.ones(n - p)] + [data[p - j : n - j] for j in range(1, p + 1)])
def prediction_rmse(data, target, predictors, p = 2, n_fit = 1000):
#regression of the series target on the past p values of the series in the list predictors
#the regression is fitted using the first n_fit time points
#the function returns the RMSE of the one-step predictions for the remaining time points
response = data[p:, target]
Z = lagged(data[:, predictors], p)
reg = sm.OLS(response[:n_fit - p], Z[:n_fit - p]).fit()
errors = response[n_fit - p:] - reg.predict(Z[n_fit - p:])
return np.sqrt(np.mean(errors ** 2))def rmse_changes(p):
#entry (i, j): percentage change in the RMSE for predicting city i when the past of city j is added to the past of city i
change = np.zeros((k, k))
for i in range(k):
own_rmse = prediction_rmse(y_cities, i, [i], p = p, n_fit = 184)
for j in range(k):
if i != j:
change[i, j] = 100 * (prediction_rmse(y_cities, i, [i, j], p = p, n_fit = 184) / own_rmse - 1)
return change
change = rmse_changes(1)
print("Percentage change in the RMSE for the row city when the past of the column city is added:")
print(pd.DataFrame(np.round(change).astype(int), index = cities, columns = labels))
print("Pairs for which the RMSE decreases by at least 5%:")
links = [(change[i, j], i, j) for i in range(k) for j in range(k) if i != j and change[i, j] <= -5]
for value, i, j in sorted(links):
direction = "west" if location[cities[j]][1] < location[cities[i]][1] else "east"
print(f"{cities[i]:>15} is helped by {cities[j]:>12}: {value:6.1f}% ({distance_km(cities[i], cities[j]):4.0f} km to the {direction})")
others = np.array([change[i, j] for i in range(k) for j in range(k) if i != j and change[i, j] > -5])
print("The other", len(others), "entries of the table are between", np.round(np.min(others), 1), "and", np.round(np.max(others), 1))
change_2 = rmse_changes(2)
print("Same pairs with p = 2:", sorted([(i, j) for value, i, j in links]) == sorted([(i, j) for i in range(k) for j in range(k) if change_2[i, j] <= -5]))
print("Distance from Seattle to the nearest of the other nine cities (km):", np.round(min(distance_km('Seattle', city) for city in cities[1:])))Percentage change in the RMSE for the row city when the past of the column city is added:
SEA LA PHX HOU CHI IND JAX CLT PHL NYC
Seattle 0 0 0 1 0 0 0 0 0 0
LosAngeles -1 0 0 1 1 0 -1 -1 0 0
Phoenix -1 -6 0 1 0 0 0 0 0 0
Houston 0 0 0 0 -2 0 -2 2 3 3
Chicago 2 0 1 1 0 6 -1 0 3 3
Indianapolis 1 0 1 4 3 0 -3 -1 2 2
Jacksonville 0 -2 0 -3 -6 -8 0 -2 0 0
Charlotte 0 -1 0 4 -13 -21 1 0 -1 -1
Philadelphia 0 0 1 3 -20 -16 1 0 0 -4
NewYork 0 0 1 2 -14 -6 1 0 0 0
Pairs for which the RMSE decreases by at least 5%:
Charlotte is helped by Indianapolis: -20.8% ( 689 km to the west)
Philadelphia is helped by Chicago: -19.6% (1073 km to the west)
Philadelphia is helped by Indianapolis: -16.3% ( 944 km to the west)
NewYork is helped by Chicago: -14.2% (1156 km to the west)
Charlotte is helped by Chicago: -13.4% ( 941 km to the west)
Jacksonville is helped by Indianapolis: -8.2% (1108 km to the west)
NewYork is helped by Indianapolis: -6.2% (1051 km to the west)
Phoenix is helped by LosAngeles: -5.9% ( 584 km to the west)
Jacksonville is helped by Chicago: -5.8% (1368 km to the west)
The other 81 entries of the table are between -4.2 and 6.5
Same pairs with p = 2: True
Distance from Seattle to the nearest of the other nine cities (km): 1531.0
We draw these pairs on a map. An arrow from city to city means that the past of city helps in predicting city , and the thickness of the arrow is proportional to the decrease in the RMSE.
#positions of the names of the cities relative to the points (chosen so that the names do not overlap)
offset = {'Seattle': (8, -4), 'LosAngeles': (-12, -16), 'Phoenix': (-4, -16), 'Houston': (-8, -16), 'Chicago': (-30, 8),
'Indianapolis': (-78, -14), 'Jacksonville': (8, -10), 'Charlotte': (8, -12), 'Philadelphia': (10, -12), 'NewYork': (8, 6)}
plt.figure(figsize = (12, 6.5))
for value, i, j in links:
lat_i, lon_i = location[cities[i]]
lat_j, lon_j = location[cities[j]]
plt.annotate('', xy = (lon_i, lat_i), xytext = (lon_j, lat_j),
arrowprops = dict(arrowstyle = '->', color = 'red', linewidth = -value / 5, mutation_scale = 20, shrinkA = 5, shrinkB = 5))
for city in cities:
lat, lon = location[city]
plt.plot(lon, lat, 'o', color = 'black')
plt.annotate(city, (lon, lat), textcoords = 'offset points', xytext = offset[city])
plt.xlim(-128, -68)
plt.ylim(26, 50)
plt.xlabel('Longitude (degrees)')
plt.ylabel('Latitude (degrees)')
plt.title('Connections found from the temperature data (an arrow goes from the city which helps to the city which is predicted)')
plt.show()
There are nine pairs for which the prediction error decreases by at least 5%, and in every one of them, the city which helps is to the west of the city which is predicted: the past of Chicago and Indianapolis helps in predicting the four cities to their east, and the past of Los Angeles helps in predicting Phoenix. In the other direction there is nothing (the largest decrease which is obtained from a city to the east is 4%, for Philadelphia from New York). With , we get the same nine pairs.
So the fitted model has found, from the temperatures alone, that the weather in the United States travels from west to east. The nine connections are between cities which are roughly 600 to 1400 km apart. This is about the distance that a weather system (a large mass of cold or warm air) travels in a day.
These are statements about prediction (Granger causality). The weather in Chicago does not cause the weather in New York. Both are caused by the same travelling weather systems, which reach Chicago first.
Example 2: GDP growth, inflation and the federal funds rate¶
The Federal Reserve (the “Fed”) is the central bank of the United States. Its main tool is the federal funds rate, which is the interest rate at which banks lend money to each other overnight. A committee of the Fed meets eight times a year and decides the level at which it wants this rate to be (the Fed then steers the rate to that level), and other interest rates in the economy (on mortgages, car loans, loans to businesses etc.) move up and down with it. By law, the Fed has two goals: stable prices (since 2012, its stated target is an inflation rate of 2% per year) and maximum employment. The usual description of what the Fed does is the following. When inflation is too high, the Fed raises the federal funds rate. Borrowing then becomes more expensive, the economy slows down, and this brings inflation down. When the economy is weak, the Fed lowers the rate.
Can we see this in data? The file GDPC1_PCEPI_FEDFUNDS_16Nov2026.csv has three quarterly series from FRED, from the first quarter of 1959 to the third quarter of 2026:
Real GDP (
GDPC1): the total value of the goods and services produced in the US, adjusted for inflation.PCE price index (
PCEPI): an index of the prices paid by consumers. The Fed’s inflation target of 2% is stated in terms of this index.Federal funds rate (
FEDFUNDS), in percent per year.
The GDP data is available quarterly on FRED. The other two series however are available monthly on FRED. But we work with their quarterly versions (also available from FRED) for consistency with GDP.
fred = pd.read_csv("GDPC1_PCEPI_FEDFUNDS_16Nov2026.csv", parse_dates = ['observation_date'])
print(fred.head(3))
print(fred.tail(3))
print("Number of quarters:", len(fred))
print("Real GDP in the last quarter divided by real GDP in the first quarter:", np.round(fred['GDPC1'].iloc[-1] / fred['GDPC1'].iloc[0], 1))
print("Price index in the last quarter divided by the price index in the first quarter:", np.round(fred['PCEPI'].iloc[-1] / fred['PCEPI'].iloc[0], 1)) observation_date GDPC1 PCEPI FEDFUNDS
0 1959-01-01 3352.129 15.177 2.57
1 1959-04-01 3427.667 15.239 3.08
2 1959-07-01 3430.057 15.331 3.58
observation_date GDPC1 PCEPI FEDFUNDS
268 2026-01-01 24274.383 129.414 3.64
269 2026-04-01 24408.011 131.006 3.63
270 2026-07-01 24611.077 131.685 3.67
Number of quarters: 271
Real GDP in the last quarter divided by real GDP in the first quarter: 7.3
Price index in the last quarter divided by the price index in the first quarter: 8.7
Below we plot the datasets.
fig, axes = plt.subplots(3, 1, figsize = (12, 8), sharex = True)
series = [
('GDPC1', 'Real GDP', 'Billions of chained dollars'),
('PCEPI', 'PCE price index', 'Index'),
('FEDFUNDS', 'Effective federal funds rate', 'Percent')
]
for ax, (column, title, units) in zip(axes, series):
ax.plot(fred['observation_date'], fred[column], color = 'tab:blue')
ax.set_title(title, loc = 'left')
ax.set_ylabel(units)
ax.grid(axis = 'y', alpha = 0.25)
axes[-1].set_xlabel('Quarter')
fig.tight_layout()
plt.show()
As in previous lectures when we worked with GDP and price indices, we shall work with their differences after taking logarithms. Specifically, define
where is the price index. The difference of the logarithms multiplied by 100 is approximately the percent change from one quarter to the next, and multiplying by 4 converts this to percent per year. So GDP growth and inflation are both in percent per year, which are the units of the federal funds rate.
growth = 400 * np.diff(np.log(fred['GDPC1'].to_numpy()))
inflation = 400 * np.diff(np.log(fred['PCEPI'].to_numpy()))
fedfunds = fred['FEDFUNDS'].to_numpy()[1:] #the first quarter is dropped (growth and inflation are not available for it)
#We put the three series in a data frame which is indexed by the quarter (this makes it easy to select time periods):
data = pd.DataFrame({'growth': growth, 'inflation': inflation, 'fedfunds': fedfunds},
index = fred['observation_date'].iloc[1:])
print(data.tail(3).round(2)) growth inflation fedfunds
observation_date
2026-01-01 2.46 4.09 3.64
2026-04-01 2.20 4.89 3.63
2026-07-01 3.31 2.07 3.67
Here are the three series that we shall work with.
fig, ax = plt.subplots(3, 1, figsize = (12, 7), sharex = True)
ax[0].plot(data.index, data['growth'], color = 'black')
ax[0].set_ylabel('GDP growth (percent per year)')
ax[1].plot(data.index, data['inflation'], color = 'black')
ax[1].set_ylabel('Inflation (percent per year)')
ax[2].plot(data.index, data['fedfunds'], color = 'black')
ax[2].set_ylabel('Federal funds rate (percent)')
for j in range(3):
ax[j].axhline(0, color = 'gray', linewidth = 0.5)
plt.tight_layout()
plt.show()
We did not difference the federal funds rate. Should we have? And should inflation be differenced once more? One way to approach these questions is to look at the estimate of in the AR(1) model : if it is close to 1, then differencing can be considered for the series.
#AR(1) model y_t = phi_0 + phi_1 y_{t-1} + error, fitted separately to each series (by least squares) for the years 1960-2007
all_series = {'log real GDP': log_gdp,
'log price index': log_price,
'GDP growth': data.loc['1960':'2007', 'growth'].to_numpy(),
'inflation': data.loc['1960':'2007', 'inflation'].to_numpy(),
'federal funds rate': data.loc['1960':'2007', 'fedfunds'].to_numpy()}
for name, s in all_series.items():
ar1 = sm.OLS(s[1:], sm.add_constant(s[:-1])).fit()
print(f"{name:20s}: estimate of phi_1 = {ar1.params[1]:.3f}")log real GDP : estimate of phi_1 = 0.998
log price index : estimate of phi_1 = 0.998
GDP growth : estimate of phi_1 = 0.259
inflation : estimate of phi_1 = 0.863
federal funds rate : estimate of phi_1 = 0.955
For log real GDP and the log price index, the estimate of is essentially 1, so these two series have to be differenced. For GDP growth, it is 0.259. Inflation (0.863) and the federal funds rate (0.955) are in between. They wander quite a bit, and one could difference them as well. We do not, because we want to study how the level of the federal funds rate is related to the level of inflation, and differencing would remove exactly this relation. So whether to difference depends on the question that we are asking, and not only on the data.
We fit the model using the 192 quarters from 1960 to 2007. After 2008, the federal funds rate was stuck near zero for many years (from 2009 to 2015, and again in 2020-21) so we remove this part of the data.
y = data.loc['1960':'2007'].to_numpy() #rows are quarters; the columns are GDP growth, inflation and the federal funds rate
n = y.shape[0]
print("Number of quarters from 1960 to 2007:", n)
#As in the last lecture, the VAR(1) model is fitted by three separate regressions
#The covariates are 1, y_{t-1}(1), y_{t-1}(2), y_{t-1}(3) for t = 2, ..., n
Z = np.column_stack([np.ones(n - 1), y[:-1]])
names = ['intercept', 'growth_{t-1}', 'inflation_{t-1}', 'fedfunds_{t-1}']
series = ['GDP growth', 'inflation', 'the federal funds rate']
for i in range(3):
eq = sm.OLS(y[1:, i], Z).fit()
print("Equation for " + series[i] + ":")
print(pd.DataFrame({'estimate': eq.params, 'std. error': eq.bse}, index = names).round(3))Number of quarters from 1960 to 2007: 192
Equation for GDP growth:
estimate std. error
intercept 4.418 0.586
growth_{t-1} 0.189 0.070
inflation_{t-1} -0.096 0.123
fedfunds_{t-1} -0.232 0.095
Equation for inflation:
estimate std. error
intercept 0.156 0.236
growth_{t-1} 0.034 0.028
inflation_{t-1} 0.810 0.050
fedfunds_{t-1} 0.072 0.038
Equation for the federal funds rate:
estimate std. error
intercept -0.214 0.169
growth_{t-1} 0.090 0.020
inflation_{t-1} 0.148 0.035
fedfunds_{t-1} 0.898 0.027
Instead of fitting regressions separately via OLS, we can also use the VAR function.
#The function VAR gives the same estimates
print("Order selected by BIC =", VAR(y).select_order(maxlags = 8).bic)
var1 = VAR(y).fit(1)
c_hat = var1.intercept
A1_hat = var1.coefs[0]
print("Estimate of the intercept:", np.round(c_hat, 2))
print("Estimate of A1:")
print(np.round(A1_hat, 2))Order selected by BIC = 1
Estimate of the intercept: [ 4.42 0.16 -0.21]
Estimate of A1:
[[ 0.19 -0.1 -0.23]
[ 0.03 0.81 0.07]
[ 0.09 0.15 0.9 ]]
Rounded to two decimal places, the fitted VAR(1) model is
We start with the third equation. It says that the Fed raises the rate when inflation and GDP growth go up, which agrees with the usual description of the Fed (and the three coefficients are large compared to their standard errors, which are 0.020, 0.035 and 0.027). But the coefficient 0.15 looks small: does the Fed raise the rate by only 0.15 points when inflation goes up by one point?
To better interpret the third regression equation, let us rewrite it in the following alternative way. Subtracting from both sides of the third equation gives
where is given by:
In words: the fedfunds equation says that, at quarter , the Fed moves the rate by about 10% of the distance to which depends on GDP growth and inflation at . This target level is given by -2.1 plus 0.88 times the current growth rate and 1.46 times the current inflation.
Here are some comments on the number 1.46. In 1993, the economist John Taylor proposed the formula as a description of the Fed (here gap is the percentage by which real GDP is above its normal level). This is known as the Taylor rule, and it is very widely used as a benchmark. Our 1.46 is very close to Taylor’s 1.5.
Note that the Fed does not set its rate by a formula. A committee looks at a large amount of information (forecasts, employment, financial markets, and so on) and makes a judgment. The fitted equation is a summary, from the outside, of what these judgments looked like on average between 1960 and 2007.
To see how good the funds equation is, we start with the actual federal funds rate in the first quarter of 1960. For every quarter after that, we calculate the rate from the fitted equation (without the error), using the actual growth and inflation of the previous quarter, and the calculated (not the actual) rate of the previous quarter. So after the first quarter, the calculation never looks at the actual federal funds rate. We continue all the way to 2026, although the equation was fitted using only the data up to 2007.
y_all = data.loc['1960':].to_numpy() #all the quarters from the first quarter of 1960 to the third quarter of 2026
quarters_all = data.loc['1960':].index
fedfunds_calc = np.zeros(len(y_all))
fedfunds_calc[0] = y_all[0, 2] #actual federal funds rate in the first quarter of 1960
for t in range(1, len(y_all)):
growth_prev, inflation_prev = y_all[t-1, 0], y_all[t-1, 1] #actual growth and inflation in the previous quarter
fedfunds_calc[t] = c3 + a3 * growth_prev + b3 * inflation_prev + rho3 * fedfunds_calc[t-1]
plt.figure(figsize = (12, 5.5))
plt.plot(quarters_all, y_all[:, 2], color = 'black', label = 'Actual federal funds rate')
plt.plot(quarters_all, fedfunds_calc, color = 'red',
label = 'Calculated from the fitted equation (using only growth and inflation)')
plt.axvline(pd.Timestamp('2008-01-01'), color = 'gray', linestyle = '--')
plt.axhline(0, color = 'gray', linewidth = 0.5)
plt.ylabel('Percent')
plt.title('Federal funds rate (the equation was fitted using the data to the left of the dashed line)')
plt.legend()
plt.show()
#The actual and the calculated federal funds rate in a few quarters:
comparison = pd.DataFrame({'actual': y_all[:, 2], 'calculated': fedfunds_calc}, index = quarters_all)
print(comparison.loc[pd.to_datetime(['1976-01-01', '1981-04-01', '2012-01-01', '2022-01-01', '2023-07-01', '2026-07-01'])].round(1))
actual calculated
1976-01-01 4.8 9.8
1981-04-01 17.8 13.0
2012-01-01 0.1 2.1
2022-01-01 0.1 4.9
2023-07-01 5.3 5.7
2026-07-01 3.7 4.9
The calculated series follows the broad movements of the actual federal funds rate over more than 60 years: the rise through the 1960s and 1970s, the peak around 1981, and the long decline after that. So the behaviour of the Fed is, to a large extent, predictable from growth and inflation. The large gaps between the two curves are well-known episodes:
1975-77: the actual rate was well below the calculated rate (4.8 against 9.8 at the beginning of 1976). Inflation then rose to more than 10% in 1979-80.
1979-82: the actual rate was much higher than the calculated rate (17.8 against 13.0 in the second quarter of 1981). This is when the Fed raised interest rates to unprecedented levels in order to bring inflation down.
2009-15 and 2020-21: the actual rate was stuck near zero (the Fed has never lowered it below zero). This is a situation which the equation knows nothing about.
2022: inflation rose sharply while the rate was still near zero (0.1 against a calculated rate of 4.9 in the first quarter of 2022). The Fed then raised the rate by more than five points in a year and a half, which is much faster than the gradual adjustment described by the equation.
The inflation equation and the price puzzle¶
The fitted VAR(1) gives the inflation equation
The coefficient 0.81 indicates that inflation is persistent. The more surprising coefficient is the +0.07 on the federal funds rate. Suppose two periods have the same growth and inflation, but the federal funds rate is in one period and in the other. The model predicts that next period’s inflation will be 0.07 percentage points higher in the first case. The estimate is about 1.8 standard errors above zero (standard error 0.038), so its approximate 95% confidence interval includes zero.
We will show in the next lecture, using impulse response analysis, that the positive coefficient of 0.07 actually implies that inflation is expected to rise two, three or more periods also (not just after one period) after a rate increase. This is surprising because the usual reasoning is that higher interest rates make borrowing more expensive. Households may postpone purchases and firms may scale back investment. The resulting decrease in demand should, over time, bring inflation below the level it would otherwise have reached.
One explanation for the positive coefficient is that the Fed raises rates when it expects inflation to rise. Suppose, for illustration, that inflation is and a jump in oil prices would push it to if the Fed held rates steady. The Fed sees the oil price increase, raises rates, and inflation reaches . The data record a rate hike followed by rising inflation. Yet in this example the hike lowered inflation by one percentage point relative to what would have happened. Because oil prices are absent from our VAR, the funds rate can help predict inflation partly by revealing what the Fed was responding to.
In the VAR literature, this kind of finding is sometimes called the price puzzle (you can read more at Price puzzle and https://
In the next lecture, we shall look at some simple toy settings to better understand and appreciate the price puzzle.