Testing Granger causality between two series

Today let's find out whether one time series can help forecast another, and what it does and does not mean when it can.

Our data is Canada's quarterly labour statistics from the OECD: 84 quarters, from 1980 Q1 to 2000 Q4. Two of the series are employment and the unemployment rate. We want to know whether last quarter's employment growth helps forecast this quarter's change in the unemployment rate.

The Granger test answers that with two forecasts of the change in the unemployment rate, and it compares their errors. We measure a forecast's error with SSE, the sum of squared errors: the squared gap between each actual value and its forecast, added up over all quarters. A smaller SSE means a better forecast.

Those three boxes are the whole test, with the numbers Canada's data gives.

What does it mean for one series to Granger-cause another?

A series X Granger-causes a series Y if the past values of X lower the forecast error of Y, beyond what the past values of Y itself already achieve. The idea comes from the economist Clive Granger.

In our data, X is the change in employment and Y is the change in the unemployment rate. So the question becomes: given the unemployment change's own last quarter, does last quarter's employment change lower the forecast error of this quarter's unemployment change?

Two things follow from that definition.

  • Only past values of X enter the test. Whatever X does in the same quarter as Y is left out.
  • The claim is about forecast error. It does not say that X makes Y happen, and it is made given the series we include in the test.

Now let's set up the data. The Canada data has four series: e is 100 times the log of civil employment, prod is a measure of labour productivity, rw is the real wage and U is the unemployment rate in percent.

We work with first differences, which means this quarter's value minus last quarter's. So d_e, the difference of e, is about the quarterly employment growth in percent, and d_U is the change in the unemployment rate in percentage points. Differencing 84 quarters leaves 83 changes.

RInteractive R
# Load the Canada data and build the quarterly changes of each series library(vars) library(forecast) data(Canada) changes <- as.data.frame(diff(Canada)) names(changes) <- c("d_e", "d_prod", "d_rw", "d_U") head(changes, 4) #> d_e d_prod d_rw d_U #> 1 0.1934707 -0.7266325 1.999650 0.17 #> 2 0.5144030 -0.8249509 2.404354 -0.23 #> 3 1.1092999 0.4008901 3.423704 -0.20 #> 4 1.2343182 0.8309404 2.800874 0.10 nrow(changes) #> [1] 83

  

We difference e because it trends upward, and the F test we will run assumes each series has a stable mean. Roughly speaking, a series whose mean stays put over time, instead of drifting, is called stationary. The function ndiffs() from the forecast package returns the number of first differences a series needs to become stationary.

RInteractive R
# Count the first differences each series needs to have a stable mean ndiffs(Canada[, "e"]) #> [1] 1 ndiffs(changes$d_e) #> [1] 0

  

So e needs 1 difference, and d_e needs none. We difference U as well, so that both regressions in the test describe quarterly changes.

Let's plot the two changes and measure how closely they move within the same quarter.

RInteractive R
# Plot the two quarterly changes and measure how closely they move together changes_ts <- ts(changes[, c("d_e", "d_U")], start = c(1980, 2), frequency = 4) plot(changes_ts, main = "Canada: quarterly changes, 1980 Q2 to 2000 Q4", xlab = "Year") round(cor(changes$d_e, changes$d_U), 3) #> [1] -0.856

  

Within the same quarter the two changes have a correlation of -0.856: quarters of strong employment growth are quarters where the unemployment rate falls. The Granger test does not use that link. It uses only what earlier quarters tell us about the current one.