Back to portfolio

How three filters read Canada's business cycles, and what they make of 2020

Canada's economy has grown by about 3% a year on average since 1961, but not steadily. The business cycle is the rise and fall around that growth. To measure it you first decide what normal output is at each date, called the trend, and then measure how far actual output is above or below it. I compare three common ways of doing this on Canadian national accounts: the Hodrick-Prescott filter, the Baxter-King filter and the Hamilton projection. Data run from 1961 to 2026Q2, and the results describe Statistics Canada's file dated August 28, 2026.

Personal project: my own analysis of publicly available data. It is not associated with my work for any current or past employer and does not represent their views.

At a glance

QuestionMethodsAnswer
How do the parts of output move?Three filters on logsInvestment swings 3.4 to 3.7 times as far as output and moves with it. Consumption also moves with output. Government purchases are close to unrelated to it.
Are net exports procyclical or countercyclical?Shares of trend output, Baxter-King, block bootstrapWeakly countercyclical: a correlation of −0.21 (−0.44 to 0.06), and about zero since 1990.
How does each filter treat 2020?Five dated recessions, pandemic smoothed out as a testLog output fell 13.6 points. Baxter-King shows −5.8, Hodrick-Prescott −12.3 and Hamilton −13.9. Hamilton then shows +11.5 in 2022Q2, an echo of the fall.
Which filter to use?Dating, leakage, real-time revisionsHodrick-Prescott for describing past cycles. Hamilton for reading the latest quarter.

How the three filters work

Line chart of output from 2005 to 2026 in trillions of 2017 dollars, with the Hodrick-Prescott trend, a smooth line through it, and Hamilton's prediction from two years earlier, which dips in 2022 after the 2020 fall. Output falls below both lines in 2008-09 and 2020.
What each filter treats as normal. The cycle is the gap between output and each line.

Hodrick-Prescott draws a smooth curve through the data, and its reading of recent years can change as new data arrive. Baxter-King keeps only movements that repeat every one and a half to eight years, and has no value for the first and last three years. Hamilton compares output with what you would have predicted two years earlier from its own past values, so it reaches the latest quarter, though the regression behind the prediction is fitted on all the data.

Explore the three filters

1. How do the parts of output move?

  • Statistics Canada table 36-10-0104
  • Quarterly, 1961-2026
  • Hodrick-Prescott lambda of 1600
  • Baxter-King, 6 to 32 quarters
Line chart of output, consumption, investment and government purchases under the Hodrick-Prescott filter, 1961 to 2026, with recessions shaded. Investment swings far more than the others, down to about −28 in 2020.
The parts of output under Hodrick-Prescott. The same chart for Baxter-King and Hamilton is on GitHub, on the same vertical scale.

Investment swings 3.4 to 3.7 times as far as output and moves with it. Consumption also moves with output, and government purchases are close to unrelated to it. Through 2019, consumption is the least volatile series under all three filters. With 2020 included, its swings grow to about the size of output's.

Standard deviation in per cent, and correlation with outputBaxter-KingHamiltonHodrick-Prescott
Output1.46, 1.003.19, 1.001.56, 1.00
Consumption1.37, 0.843.20, 0.811.52, 0.82
Investment5.43, 0.8410.68, 0.825.68, 0.81
Government purchases1.08, −0.033.21, 0.161.21, 0.03

2. Are net exports procyclical or countercyclical?

Line chart of output, consumption, investment, government purchases and net exports as shares of trend output, Baxter-King filtered, 1964 to 2023. Net exports often rise as output falls, and their swings are as large as consumption's.
Each series divided by the trend of output, then filtered.

Net exports are sometimes negative, so they have no log. Dividing each series by the trend of output gets around this, and it also shows how much each part contributes. On this measure investment accounts for 71% of the variance in output, and consumption for 36%.

Net exports are weakly countercyclical. The correlation with output is −0.21, with a 95% range of −0.44 to 0.06, and it is about zero since 1990. They rose during the 1981-82, 2008-09 and 2020 recessions and barely moved in the other two.

3. 2020 against earlier recessions

Line chart of output with the trend taken out, 2018 to 2024, under three filters. Baxter-King falls from 2019 and reaches −5.8. Hodrick-Prescott rises to +2.1 before the fall and reaches −12.3. Hamilton reaches −13.9, then jumps to +11.5 in 2022.
One fall in output, read three ways.

Log output fell 13.6 points from 2019Q4 to 2020Q2, about four times the average of the four earlier recessions. Baxter-King shows −5.8, about twice its usual low, because it removes much of a fall and rebound that fast. Hodrick-Prescott shows −12.3, and its trend bends down to meet the fall, lifting 2019 by up to 1.7 points. Hamilton shows −13.9, then +11.5 in 2022Q2, when the low quarters of 2020 reach its lags. That is its largest reading in the sample. If the pandemic is replaced with a straight line, 10.6 points of it go away.

RecessionFall in log outputBaxter-King lowHamilton lowHodrick-Prescott low
1974-751.1−2.0−3.4−2.5
1981-825.5−4.4−9.3−5.3
1990-922.5−2.1−8.5−2.3
2008-094.5−3.2−6.6−3.5
202013.6−5.8−13.9−12.3

Log points, or per cent from trend. The low is taken within four quarters of the recession.

4. Which filter to use

For describing past cycles, I would use Hodrick-Prescott. Its low falls in the dated trough quarter in all five recessions, output is above trend at all five peaks, and 2020 moves other quarters less than it does under the other filters. For reading the latest quarter I would use Hamilton. Hodrick-Prescott's first reading has the wrong sign 37% of the time once later data arrive, against 12% for Hamilton, and Baxter-King has no reading for the last 12 quarters.

TestBaxter-KingHamiltonHodrick-Prescott
Low falls in the dated trough quarter, of 5 recessions145
Output above trend at the dated peak, of 5 recessions425
Largest leakage from 2020 outside the pandemic2.610.61.7
First reading has the wrong signno reading12%37%
Latest quarter available2023Q22026Q22026Q2

These tests lean toward filters that follow output closely, and the recession dates rest partly on GDP. They also don't test Hamilton's objection that Hodrick-Prescott can create cycles where there are none.

Data

Statistics Canada table 36-10-0104, quarterly, in chained 2017 dollars, seasonally adjusted at annual rates. Recession dates from the C.D. Howe Institute Business Cycle Council.

Adapted from Statistics Canada; this does not constitute an endorsement by Statistics Canada of this product.