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.

Example 1: Daily temperatures in ten cities

title: VAR Models: Two Real Data Examples

In the last lecture, we discussed some simple physics examples where the VAR(2) model is motivated by basic physics. The estimate of the matrix A1A_1 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.

Example 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://github.com/fivethirtyeight/data/tree/master/us-weather-history). We list the cities from west to east, and we use this order throughout. The latitudes and longitudes below are approximate. They are used only for calculating distances and for drawing a map (not for fitting any model).

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.

<Figure size 1200x700 with 3 Axes>

As in the last lecture, we work with temperature anomalies instead of the daily temperatures. Let yt(i)y_t(i) denote the temperature in city ii on day tt minus the normal temperature in city ii for that date.

We fit the VAR(1) model yt=c+A1yt−1+ϵty_t = c + A_1 y_{t-1} + \epsilon_t to the ten series. There are ten equations with eleven coefficients each, so 110 coefficients are estimated from 364 days (p=1p = 1 is the order selected by BIC). In the table below, the rows correspond to today, and the columns to yesterday.

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

New York today≈1.21+0.59×(New York yesterday)+0.32×(Chicago yesterday)+0.22×(Indianapolis yesterday)\text{New York today} \approx 1.21 + 0.59 \times (\text{New York yesterday}) + 0.32 \times (\text{Chicago yesterday}) + 0.22 \times (\text{Indianapolis yesterday})

(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 jj actually helps in predicting city ii.

For every pair of cities ii and jj, we compare two predictions of city ii: the prediction from its own past, and the prediction from its own past together with the past of city jj. 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 p=1p = 1. 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.

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 jj to city ii means that the past of city jj helps in predicting city ii, and the thickness of the arrow is proportional to the decrease in the RMSE.

<Figure size 1200x650 with 1 Axes>

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 p=2p = 2, 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:

  1. Real GDP (GDPC1): the total value of the goods and services produced in the US, adjusted for inflation.

  2. 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.

  3. 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.

  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.

<Figure size 1200x800 with 3 Axes>

As in previous lectures when we worked with GDP and price indices, we shall work with their differences after taking logarithms. Specifically, define

growtht=400(log⁡GDPt−log⁡GDPt−1)   and   inflationt=400(log⁡Pt−log⁡Pt−1)\text{growth}_t = 400 \left(\log \text{GDP}_t - \log \text{GDP}_{t-1} \right) ~~~ \text{and} ~~~ \text{inflation}_t = 400 \left(\log P_t - \log P_{t-1} \right)

where PtP_t 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  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.

<Figure size 1200x700 with 3 Axes>

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 ϕ1\phi_1 in the AR(1) model yt=ϕ0+ϕ1yt−1+ϵty_t = \phi_0 + \phi_1 y_{t-1} + \epsilon_t: if it is close to 1, then differencing can be considered for the series.

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 ϕ1\phi_1 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.

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.

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

growtht=4.42+0.19 growtht−1−0.10 inflationt−1−0.23 fedfundst−1+errorinflationt=0.16+0.03 growtht−1+0.81 inflationt−1+0.07 fedfundst−1+errorfedfundst=−0.21+0.09 growtht−1+0.15 inflationt−1+0.90 fedfundst−1+error.\begin{align*} \text{growth}_t &= 4.42 + 0.19 \, \text{growth}_{t-1} - 0.10 \, \text{inflation}_{t-1} - 0.23 \, \text{fedfunds}_{t-1} + \text{error} \\ \text{inflation}_t &= 0.16 + 0.03 \, \text{growth}_{t-1} + 0.81 \, \text{inflation}_{t-1} + 0.07 \, \text{fedfunds}_{t-1} + \text{error} \\ \text{fedfunds}_t &= -0.21 + 0.09 \, \text{growth}_{t-1} + 0.15 \, \text{inflation}_{t-1} + 0.90 \, \text{fedfunds}_{t-1} + \text{error}. \end{align*}

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 fedfundst−1\text{fedfunds}_{t-1} from both sides of the third equation gives

fedfundst−fedfundst−1=0.10(targett−1−fedfundst−1)+error.\text{fedfunds}_t - \text{fedfunds}_{t-1} = 0.10 \left(\text{target}_{t-1} - \text{fedfunds}_{t-1} \right) + \text{error} .

where targett−1\text{target}_{t-1} is given by:

targett−1=−2.10+0.88×growtht−1+1.46×inflationt−1.\begin{align*} \text{target}_{t-1} = -2.10 + 0.88 \times \text{growth}_{t-1} + 1.46 \times \text{inflation}_{t-1}. \end{align*}

In words: the fedfunds equation says that, at quarter tt, the Fed moves the rate by about 10% of the distance to targett−1\text{target}_{t-1} which depends on GDP growth and inflation at t−1t-1. 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 federal funds rate=1+1.5×inflation+0.5×gap\text{federal funds rate} = 1 + 1.5 \times \text{inflation} + 0.5 \times \text{gap} 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.

<Figure size 1200x550 with 1 Axes>
            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:

  1. 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.

  2. 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.

  3. 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.

  4. 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

inflationt=0.16+0.03 growtht−1+0.81 inflationt−1+0.07 fedfundst−1+εt.\text{inflation}_t = 0.16 + 0.03\,\text{growth}_{t-1} + 0.81\,\text{inflation}_{t-1} + 0.07\,\text{fedfunds}_{t-1} + \varepsilon_t.

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 5%5\% in one period and 4%4\% 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 2%2\% and a jump in oil prices would push it to 4%4\% if the Fed held rates steady. The Fed sees the oil price increase, raises rates, and inflation reaches 3%3\%. 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://www.dallasfed.org/~/media/documents/research/er/1994/er9404b.pdf).

In the next lecture, we shall look at some simple toy settings to better understand and appreciate the price puzzle.