# Details on calculation of trend-cycle estimates at Statistics Canada

This document details the way Statistics Canada calculates trend-cycle estimates. It is intended as a technical document to support users who wish to apply trend-cycle estimation to monthly series available on CANSIM. General formulas outlining the mathematical calculations are presented below, and the derivation and application of the moving average weights are provided. For more information on the use of trend-cycle estimates in analysis, please refer to "Trend-cycle estimates: Frequently asked questions" (Statistics Canada 2015).

The trend-cycle estimation method used at Statistics Canada applies moving averages and does not remove seasonal patterns. This procedure is intended for monthly series with at least 13 data points that do not exhibit seasonal patterns (either because no seasonality exists, or because it has been removed by seasonal adjustment).

## 1.0 The general formula

For each month t, the following formula is applied to estimate the trend-cycle, denoted as $T{C}_{t}$:

Formula 1

where ${Y}_{j}$ is the value of the input series for month $j$, available for $j=1,\dots ,T$. If the value of the input series for month $j$ is available, ${I}_{j}$ is an indicator equal to 1. Otherwise, it is equal to 0. Applying this formula near the beginning or end of a series leads to undefined terms (e.g. ${Y}_{0}$ ), discussed in Section 1.1. The quantities shown as ${W}_{j}^{\left(t\right)}$ represent the moving average weights applied to month for the calculation of the trend-cycle for month t. This is referred to as the cascade linear filter, as derived by Dagum and Luati (2009) and presented in Table 1.

Table 1  Full-precision moving average weights for calculating the trend-cycle for month t
Months Weights
t-6 and t+6 -0.027
t-5 and t+5 -0.007
t-4 and t+4 0.031
t-3 and t+3 0.067
t-2 and t+2 0.136
t-1 and t+1 0.188
t 0.224

Applying formula (1) for each month $t=1,\dots ,T$ yields the trend-cycle series.

### 1.1 Applying the general formula

The weights presented in Table 1 were developed by combining several filters that are each optimal for specific purposes. The combined results provide robust trend-cycle estimates with good statistical properties. For more information, see Dagum and Luati (2009).

By design, aggregating the weights in Table 1 for all months from (t-6) to (t+6) gives an exact total of 1. This is necessary so that the level of the trend-cycle series is the same on average as the level of the input series. Note that when we derive the trend-cycle estimates for the first six and the last six months of the input series, formula (1) includes terms that are not defined, such as Y0. However, these terms can be assumed to be 0 since they disappear when multiplied by the corresponding indicator coefficient, I0, which equals 0 by definition. In these cases, the denominator in formula (1) represents an adjustment to the moving average weights. Referred to as the cut-and-normalize approach, this ensures that the moving average weights used to estimate the trend-cycle for each month add up to 1. In the cut-and-normalize approach, the weights of the months for which data are unavailable are redistributed proportionally to the months for which data are available. For all other months, the denominator in formula (1) is equal to 1, and the formula is reduced to a simple symmetric moving average with the weights specified in Table 1.

### 1.2 Alternate expression

In formula (1), a cut-and-normalize approach is used to derive the moving average weights for the first and last six months of the input series. In effect, the cut-and-normalize approach to estimating the trend-cycle employs modified moving average weights to calculate the trend-cycle of the first six months of the series and the final six months. For example, when the trend-cycle estimate for the final month of a series is calculated, the values of the six subsequent months are not yet known. The cut-and-normalize approach proportionally rescales the weights for the months that are available so that their sum is 1. An equivalent expression to formula (1) is given in formula (2), which is based on the rescaled moving average weights, ${\stackrel{˜}{W}}_{j}^{\left(t\right)}$, given in formula (3).

Formula 2

Formula 3

## 2.0 Illustration

To illustrate how to compute and apply the moving average weights, we consider a monthly series, ${Y}_{t}$, that spans from January 2010 to July 2015—a total of 67 months. The rescaled moving average weights in the formulas below have been rounded to six decimal places. This rounding will sometimes lead to an overestimation or an underestimation at the beginning and end of the series. Because of rounding errors, the trend-cycle obtained using these rounded weights will not be precise within these sections. The full-precision weights must be used to reproduce published trend-cycle estimates exactly.

Three examples below illustrate trend-cycle estimates near the beginning, middle and end of the series. These demonstrate the application of the moving averages when not all months of the 13-term moving average are available (examples 1 and 3), as well as when they are (example 2).

### Example 1

For the March 2010 trend-cycle estimate (t=3 of the series), the ${Y}_{j}$ values are available only for j=1,...,9, which correspond to January 2010 to September 2010. Therefore, a nine-term moving average is used.

According to formula (3), the rescaled weight applied to January 2010 for this moving average is

.

Approximate values of the rescaled moving average weights, ${\stackrel{˜}{W}}_{j}^{\left(3\right)}$, calculated for the months included in the moving average to estimate the trend-cycle for month 3, are shown in Table 2.

Table 2  Rescaled moving average weights (approximate values) for March 2010
Reference month Weight Approximate value
j=1 (Jan. 2010) ${\stackrel{˜}{W}}_{1}^{\left(3\right)}$ 0.145299
j=2 (Feb. 2010) ${\stackrel{˜}{W}}_{2}^{\left(3\right)}$ 0.200855
j=3 (Mar. 2010) ${\stackrel{˜}{W}}_{3}^{\left(3\right)}$ 0.239316
j=4 (Apr. 2010) ${\stackrel{˜}{W}}_{4}^{\left(3\right)}$ 0.200855
j=5 (May 2010) ${\stackrel{˜}{W}}_{5}^{\left(3\right)}$ 0.145299
j=6 (June 2010) ${\stackrel{˜}{W}}_{6}^{\left(3\right)}$ 0.071581
j=7 (July 2010) ${\stackrel{˜}{W}}_{7}^{\left(3\right)}$ 0.033120
j=8 (Aug. 2010) ${\stackrel{˜}{W}}_{8}^{\left(3\right)}$ -0.007479
j=9 (Sept. 2010) ${\stackrel{˜}{W}}_{9}^{\left(3\right)}$ -0.028846

Finally, applying formula (2) to the input series ${Y}_{j}$ gives the following expression for $T{C}_{3}$, the trend-cycle estimate for March 2010:

### Example 2

For the August 2012 trend-cycle estimate (t=32 of the series), the values of ${Y}_{j}$ are available for each month from j=26,...,38, which correspond to February 2012 to February 2013. Therefore, a complete 13-term moving average is used. Because the denominator of formula (3) is exactly equal to 1 in this case, the rescaling has no effect and the weights used in the moving average are identical to the weights in Table 1.

The rescaled weight applied to August 2012 in this moving average is given by

The rescaled moving average weights, ${\stackrel{˜}{W}}_{j}^{\left(32\right)}$, calculated for the months included in the moving average used to calculate the trend-cycle estimate for month 32, are presented in Table 3.

Table 3  Rescaled moving average weights to calculate trend-cycle for August 2012
Reference month(s) Weight Value
j=26 (Feb. 2012) and j=38 (Feb. 2013) ${\stackrel{˜}{W}}_{26}^{\left(32\right)},{\stackrel{˜}{W}}_{38}^{\left(32\right)}$ -0.027
j=27 (Mar. 2012) and j=37 (Jan. 2013) ${\stackrel{˜}{W}}_{27}^{\left(32\right)},{\stackrel{˜}{W}}_{37}^{\left(32\right)}$ -0.007
j=28 (Apr. 2012) and j=36 (Dec. 2012) ${\stackrel{˜}{W}}_{28}^{\left(32\right)},{\stackrel{˜}{W}}_{36}^{\left(32\right)}$ 0.031
j=29 (May 2012) and j=35 (Nov. 2012) ${\stackrel{˜}{W}}_{29}^{\left(32\right)},{\stackrel{˜}{W}}_{35}^{\left(32\right)}$ 0.067
j=30 (June 2012) and j=34 (Oct. 2012) ${\stackrel{˜}{W}}_{30}^{\left(32\right)},{\stackrel{˜}{W}}_{34}^{\left(32\right)}$ 0.136
j=31 (July 2012) and j=33 (Sept. 2012) ${\stackrel{˜}{W}}_{31}^{\left(32\right)},{\stackrel{˜}{W}}_{33}^{\left(32\right)}$ 0.188
j=32 (Aug. 2012) ${\stackrel{˜}{W}}_{32}^{\left(32\right)}$ 0.224

Applying formula (2) to the input series ${Y}_{j}$ produces the following expression for the August 2012 trend-cycle estimate, $T{C}_{32}$:

### Example 3

For the July 2015 trend-cycle estimate (t=67 of the series), the values of ${Y}_{j}$ are known only for each month from j=61,...,67, which correspond to January 2015 to July 2015. Therefore, a seven-term moving average is used.

The rescaled weight applied to July 2015 in this moving average is

The rescaled moving average weights, ${W}_{j}^{\left(67\right)}$, calculated for the other months included in the moving average used to calculate the trend-cycle estimate for month 67, are presented in Table 4.

Table 4  Rescaled moving average weights (approximate values) for July 2015
Reference month Weight Approximate value
j=61 (Jan. 2015) ${\stackrel{˜}{W}}_{61}^{\left(67\right)}$ -0.044118
j=62 (Feb. 2015) ${\stackrel{˜}{W}}_{62}^{\left(67\right)}$ -0.011438
j=63 (Mar. 2015) ${\stackrel{˜}{W}}_{63}^{\left(67\right)}$ 0.050654
j=64 (Apr. 2015) ${\stackrel{˜}{W}}_{64}^{\left(67\right)}$ 0.109477
j=65 (May 2015) ${\stackrel{˜}{W}}_{65}^{\left(67\right)}$ 0.222222
j=66 (June 2015) ${\stackrel{˜}{W}}_{66}^{\left(67\right)}$ 0.307190
j=67 (July 2015) ${\stackrel{˜}{W}}_{67}^{\left(67\right)}$ 0.366013

Applying formula (2) to the input series ${Y}_{j}$ gives the following expression for the July 2015 trend-cycle estimate, $T{C}_{67}$:

### 3.0 Exact weights

A summary of the rescaled moving average weights, ${\stackrel{˜}{W}}_{j}^{\left(t\right)}$, that are used in calculating the trend-cycle estimates over the entire series are given in Table 5.

Table 5  Rescaled weights for each month, derived under the cut-and-normalize approach
j=t-6 j=t-5 j=t-4 j=t-3 j=t-2 j=t-1 j=t j=t+1 j=t+2 j=t+3 j=t+4 j=t+5 j=t+6
t=1 0 0 0 0 0 0 =(0.224) / (0.612) =(0.188) / (0.612) =(0.136) / (0.612) =(0.067) / (0.612) =(0.031) / (0.612) =(-0.007) / (0.612) =(-0.027) / (0.612)
t=2 0 0 0 0 0 =(0.188) / (0.8) =(0.224) / (0.8) =(0.188) / (0.8) =(0.136) / (0.8) =(0.067) / (0.8) =(0.031) / (0.8) =(-0.007) / (0.8) =(-0.027) / (0.8)
t=3 0 0 0 0 =(0.136) / (0.936) =(0.188) / (0.936) =(0.224) / (0.936) =(0.188) / (0.936) =(0.136) / (0.936) =(0.067) / (0.936) =(0.031) / (0.936) =(-0.007) / (0.936) =(-0.027) / (0.936)
t=4 0 0 0 =(0.067) / (1.003) =(0.136) / (1.003) =(0.188) / (1.003) =(0.224) / (1.003) =(0.188) / (1.003) =(0.136) / (1.003) =(0.067) / (1.003) =(0.031) / (1.003) =(-0.007) / (1.003) =(-0.027) / (1.003)
t=5 0 0 =(0.031) / (1.034) =(0.067) / (1.034) =(0.136) / (1.034) =(0.188) / (1.034) =(0.224) / (1.034) =(0.188) / (1.034) =(0.136) / (1.034) =(0.067) / (1.034) =(0.031) / (1.034) =(-0.007) / (1.034) =(-0.027) / (1.034)
t=6 0 =(-0.007) / (1.027) =(0.031) / (1.027) =(0.067) / (1.027) =(0.136) / (1.027) =(0.188) / (1.027) =(0.224) / (1.027) =(0.188) / (1.027) =(0.136) / (1.027) =(0.067) / (1.027) =(0.031) / (1.027) =(-0.007) / (1.027) =(-0.027) / (1.027)
t=7,…,T-6 -0.027 -0.007 0.031 0.067 0.136 0.188 0.224 0.188 0.136 0.067 0.031 -0.007 -0.027
t=T-5 =(-0.027) / (1.027) =(-0.007) / (1.027) =(0.031) / (1.027) =(0.067) / (1.027) =(0.136) / (1.027) =(0.188) / (1.027) =(0.224) / (1.027) =(0.188) / (1.027) =(0.136) / (1.027) =(0.067) / (1.027) =(0.031) / (1.027) =(-0.007) / (1.027) 0
t=T-4 =(-0.027) / (1.034) =(-0.007) / (1.034) =(0.031) / (1.034) =(0.067) / (1.034) =(0.136) / (1.034) =(0.188) / (1.034) =(0.224) / (1.034) =(0.188) / (1.034) =(0.136) / (1.034) =(0.067) / (1.034) =(0.031) / (1.034) 0 0
t=T-3 =(-0.027) / (1.003) =(-0.007) / (1.003) =(0.031) / (1.003) =(0.067) / (1.003) =(0.136) / (1.003) =(0.188) / (1.003) =(0.224) / (1.003) =(0.188) / (1.003) =(0.136) / (1.003) =(0.067) / (1.003) 0 0 0
t=T-2 =(-0.027) / (0.936) =(-0.007) / (0.936) =(0.031) / (0.936) =(0.067) / (0.936) =(0.136) / (0.936) =(0.188) / (0.936) =(0.224) / (0.936) =(0.188) / (0.936) =(0.136) / (0.936) 0 0 0 0
t=T-1 =(-0.027) / (0.8) =(-0.007) / (0.8) =(0.031) / (0.8) =(0.067) / (0.8) =(0.136) / (0.8) =(0.188) / (0.8) =(0.224) / (0.8) =(0.188) / (0.8) 0 0 0 0 0
t=T =(-0.027) / (0.612) =(-0.007) / (0.612) =(0.031) / (0.612) =(0.067) / (0.612) =(0.136) / (0.612) =(0.188) / (0.612) =(0.224) / (0.612) 0 0 0 0 0 0

## References

Dagum, E.B., and Luati, A. 2009. “A cascade linear filter to reduce revisions and false turning points for real time trend-cycle estimation.” Econometric Reviews 28 (1–3): 40–59.

Date modified: