Quantile regression version of Hodrick–Prescott filter

Hodrick–Prescott (HP) filter is a popular trend filtering method for univariate macroeconomic time series such as real gross domestic product. This paper considers the quantile regression version of HP filter (qHP filter), which is a filtering method defined by replacing quadratic loss function of HP filter with quantile regression loss function. One of the essential properties of quantile regression is that if the regression includes intercept, then the ratio of negative residuals can be almost controlled. Does the suggested qHP filter also have the property? This paper answers this question. In addition to the main result, we provide an empirical illustration.


Introduction
filter is a popular trend filtering method for univariate macroeconomic time series such as real gross domestic product (GDP). For example, it has been used for calculating the composite leading indicators of the Organisation for Economic Co-operation and Development since December 2008 (OECD 2012 ). Recent studies of the filter include de Jong and Sakarya (2016), Cornea-Madeira (2017), Hamilton (2018), Sakarya and de Jong (2020), Phillips and Jin (2021), Phillips and Shi (2021), Yamada (2015Yamada ( , 2018aYamada ( , 2018bYamada ( , 2020Yamada ( , 2022, and Yamada and Jahra The author is grateful to an anonymous referee and the coordinating editor, Robert M. Kunst, for their valuable comments and suggestions. He also thanks the participants of the 3rd International Conference on Econometrics and Statistics (EcoSta 2019) held at National Chung Hsing University in Taiwan where y 1 , . . . , y T denote T observations of an economic time series, ψ is a positive smoothing parameter that controls fidelity and smoothness, and denotes a difference operator such that x t = x t − x t−1 and accordingly 2 Quantile regression was developed by Koenker and Bassett (1978). It is the regression defined by where ρ τ (u) denotes the check function defined by where τ ∈ (0, 1). See Fig. 1, which depicts ρ τ (u) for τ = 0.1, 0.5, 0.9. Thus, it includes least absolute deviations as its special case. One of the essential properties of the τ quantile regression above is that if the regression includes intercept, the ratio of negative residuals, denoted by N /T , is less than or equal to τ and is greater than or equal to τ minus the ratio of zero residuals, denoted by Z /T : See Theorem 3.4 of Koenker and Bassett (1978) and Theorem 2.2 of Koenker (2005). From (4), for example, if τ = 0.1, then the ratio of negative residuals is at most 10%.
In this paper, we consider the quantile regression version of HP filter. It is the filtering method that is defined by replacing quadratic loss function of HP filter with quantile regression loss function. More precisely, it is: where λ is a positive smoothing parameter. In the paper, we refer to (5) as quantile Hodrick-Prescott (qHP) filter. Does the suggested qHP filter also have the property given by (4)? It is not a trivial question and is essential for applying the filter. In this paper, we answer this question. For this purpose, we apply the reparameterization used by Paige and Trindade (2010). Other than the main result, we present an empirical example. This paper is organized as follows. In Sect. 2, we present some preliminary results. In Sect. 3, we present the main results of the paper. In Sect. 4, we present an empirical example. Section 5 concludes the paper. In the Appendix, we provide MATLAB and R user-defined functions for solving the minimization problem (5).

Matrix representations of HP and qHP filters
In matrix notation, (1) can be represented as Likewise, given that ρ τ (u) in (3) can be represented as 0.5|u| from which (5) can be represented as follows: Note that when τ = 0.5, (9) reduces to which is the filtering method that is defined by replacing quadratic loss function of HP filter with absolute loss function and thus it is more robust to outliers than the HP filter.

Matrices A and D
A in (6) was used by Paige and Trindade (2010) to derive a ridge regression representation of the HP filter. Given that | A| = 1, A is nonsingular. Moreover, from Paige and Trindade (2010), it follows that Thus, given that J ∈ R (T −2)×T is a selection matrix, we have J A −1 = D, and it immediately follows that Note that D = I T −2 , i.e., is a right-inverse matrix of D.

Solution set of qHP filter
Concerning f (x), we have the following results:

and (ii) the corresponding solution set is convex.
Proof See the Appendix.
Remark 2.2 (i) Proposition 2.1(i) indicates that x is a global minimizer of qHP filter.
(ii) MATLAB and R user-defined functions for obtaining x are given in the Appendix.

Reparameterization of qHP filter
Let θ = [θ 1 , . . . , θ T ] and θ = [ θ 1 , . . . , θ T ] be T -dimensional column vectors such that x = Aθ and x = A θ , respectively. Recall that A is nonsingular and its first (second) column is ι (z). From (12), we have Dx = D Aθ = Jθ = [θ 3 , . . . , θ T ] ∈ R T −2 , which leads to Accordingly, the objective function of qHP filter can be represented with θ as follows: Given that x is a global minimizer, combining the above equations yields the inequality such as which shows that θ = A −1 x is a solution of the penalized quantile regression defined by This is an alternative representation of qHP filter.

The main results
The following result answers the question posed in Sect. 1.

Theorem 3.1 Let N and Z denote the proportion of negative and zero entries of the residual vector y
Proof Given that θ is a global minimizer of a convex function g(θ) in (15), 0 must belong to the subdifferential of g(θ) at θ, that is, there must exist the following where for t = 1, . . . , T . Then, given that the first column of A is ι and J J = diag(0, 0, 1, . . . , 1) ∈ R T ×T , the first row of (17) In addition, by definition of v in (18), it follows that P − N − Z ≤ ι v ≤ P − N + Z , where P = T − N − Z . By eliminating P from these inequalities, we obtain Substituting (19) into (20) yields N ≤ T τ ≤ N + Z . By dividing the inequalities by T > 0 and rearranging them, we finally obtain (16).

Remark 3.2
It is notable that the property derives from θ 1 being not penalized in (15).
Next, we provide another property of qHP filter.

Proposition 3.3 Denote the convex solution set of qHP filter by S. If y / ∈ S, then it follows that
Proof From Proposition 2.1, x is a global minimizer of f (x) and it thus follows that In addition, given (9), we have f ( y) = λ D y 2 2 . Moreover, given that ρ τ (y t − x t ) ≥ 0 for t = 1, . . . , T , we have f ( x) ≥ λ D x 2 2 . By combining these results, we obtain if y / ∈ S. Finally, dividing the above inequalities by λ > 0 leads to (21). Weinert (2007, p. 961) and indicates that x is smoother than y.

An empirical illustration
As an empirical illustration of qHP filter, we estimate several qHP trends of the growth rates of US real GDP and real consumption, which were used in the empirical analysis of Müller and Watson (2018). 1 To apply qHP filter, we must specify its smoothing parameter λ in (5)/(9). We selected them so that x may satisfy For obtaining x HP in (22), we must specify ψ in (1)/(7). We used the following three values of ψ: ψ = 26307.9, 133107.9, 420602.7.
Note that, given the data frequency is quarterly, p = 80, for example, corresponds to 20 years. For details about (24), see Yamada (2022, Sec. 4). 2 The values of λ corresponding to the values of ψ in (23) are tabulated in Table 1.   Figure 2 (resp. 3) shows empirical cumulative distribution function plots of residuals, y − x, cumulative distributions of residuals, y − x, where y denotes the growth rates of US real GDP (resp. consumption) and x denotes the trends estimated by qHP filter. From the figures, we can observe that in all cases the ratio of negative residuals almost equals the corresponding value of τ and these results are consistent with Theorem 3.1. For example, from the top left panel of Fig. 2, we observe that the ratio of negative residuals corresponding to Fig. 4 The dashed lines labeled by GDP denote the growth rates of US real GDP used in the empirical analysis of Müller and Watson (2018). The solid lines represent the trends estimated by qHP filter τ = 0.9, 0.5, 0.1 are nearly equal to 90%, 50%, 10%, respectively. See three bullets in the panel. Figures 4 and 5 show the trends estimated by qHP filter. From these figures, we may observe the estimated 90% (resp. 10%) qHP trends are roughly decreasing (resp. increasing) over the sample period. As a result, the bands of these quantile trends become narrower. We note that these results are consistent with a stylized fact called the Great Moderation in the US economy, which is defined as the decline in macroeconomic volatility starting in the mid-1980s. Here, we would like to stress that such results are never obtainable from applying HP filter.

Fig. 5
The dashed lines labeled by CON denote the growth rates of US real consumption used in the empirical analysis of Müller and Watson (2018). The solid lines represent the trends estimated by qHP filter

Conclusion
Theorem 3.1 is the main result of the paper. It states that even though qHP filter is a penalized quantile regression, it satisfies one of the essential properties of quantile regression given by (4). The key point is that θ 1 in (15) is not penalized. The empirical results illustrate Theorem 3.1. As a result, it is shown that qHP filter could be a useful macroeconometric tool.
Funding This study was funded by the Japan Society for the Promotion of Science (KAKENHI Grant (Bertsekas 1999, Proposition B.4(d)), and thus we have which shows that f (x) is convex. (iii) Given that f (x) is convex, it is continuous (Bertsekas 1999, Proposition B.9(a) In addition, let α ∈ [0, 1] and x 1 , x 2 ∈ S * and denote (1 − α) by β. Then, given that f (x) is convex and f (x i ) ≤ f (x) for i = 1, 2, it follows that which indicates that αx 1 + β x 2 ∈ S * and thus S * is convex.

A.3 MATLAB user-defined function
We provide a MATLAB user-defined function for obtaining x. We note that it depends on CVX, a package for specifying and solving convex programs (CVX Research, Inc 2011; Grant and Boyd 2008).

A.4 R user-defined function
We provide an R user-defined function for obtaining x. We note that it depends on CVXR, an R package for specifying and solving convex programs (Fu et al. 2020).