Hodrick-Prescott filter for trend and cyclical components
hpfilter( plots the data of the time series variables (columns) of Y)Y and their respective trend components computed by the Hodrick-Prescott Filter. The smoothing parameter is 1600, which is appropriate for quarterly periodicity[1]. hpfilter plots all time series and their respective trend components on the same axes.
For high-frequency series, the Hodrick-Prescott filter can produce anomalous endpoint effects. In this case, do not extrapolate the series using the results of the filter.
[1] Hodrick, Robert J., and Edward C. Prescott. "Postwar U.S. Business Cycles: An Empirical Investigation." Journal of Money, Credit and Banking 29, no. 1 (February 1997): 1–16. https://doi.org/10.2307/2953682.