Computes the cyclical component of a given time series using the Hodrick–Prescott filter.
Syntax
NxHP(X, Order, Lambda, Freq)
- X
- is the univariate time series data (a one-dimensional array of cells (e.g., rows or columns)).
- Order
- is the time order in the data series (i.e., the first data point's corresponding date (earliest date = 1 (default), latest date = 0)).
Order Description 1 ascending (the first data point corresponds to the earliest date) (default) 0 descending (the first data point corresponds to the latest date) - Lambda
- is the multiplier used to penalize the variation in the trend component. If missing, a default is used based on the data frequency.
- Freq
- is the frequency of the input time series (1 = quarterly (default), 2 = annual, 3 = monthly).
Remarks
- The time series is homogeneous or equally spaced.
- The time series may include missing values (e.g., #N/A) at either end.
- If lambda and data frequency are missing, a default value of 1600 is used.
- The Hodrick–Prescott filter is a mathematical tool used to separate the cyclical component of a time series from raw data:
$$ y_t = c_t + \tau_t $$
Where:
- $ t=1,2,\cdots , T$.
- $y_t$ is the input time series.
- $c_t$ is the cyclical component.
- $\tau_t$ is the trend component.
- Hodrick and Prescott (1997) suggest the following criterion to reveal the unobserved components, $\tau_t$ and $c_t$, conditional on a choice of "smoothing parameter" $\lambda$:
$$\min_{\tau}\left(\sum_{t = 1}^T {(y_t - \tau _t )^2 } + \lambda \sum_{t = 2}^{T - 1} {[(\tau _{t+1} - \tau _t) - (\tau _t - \tau _{t - 1} )]^2 }\right)$$ - An expert judgment for the choice of λ is necessary. Generally, the closer λ is to zero, the closer the filtered trend is to the original series. Likewise, if λ approaches infinity, the filtered trend becomes a straight line.
- Hodrick and Prescott proposed a default value for the smoothing parameter: 1600 for quarterly data, 100 for annual data, and 14400 for monthly data.
- The Hodrick–Prescott filter is used to obtain a smoothed-curve representation of a time series, one that is more sensitive to long-term than to short-term fluctuations.
- The HP filter is a fast and easy-to-use alternative to other techniques, such as the production function approach or the Kalman filter.
- Proper seasonal adjustment should be carried out before HP filtering.
- HP Analysis is purely historical and static (closed domain). The filter causes misleading predictions when used dynamically since the algorithm changes (during iteration for minimization) the past state (unlike a moving average) of the time series to adjust for the current state, regardless of the size of $\lambda$ used.
Files Examples
Related Links
References
- Hodrick, R., Prescott, E. (1997): "Postwar U.S. Business Cycles: An Empirical Investigation", Journal of Money, Credit, and Banking, 29(1), pp. 1-16.
- Beveridge, S., Nelson, C. R. (1981): "A New Approach to Decomposition of Economic Time Series into Permanent and Transitory Components with Particular Attention to Measurement of the Business Cycle", Journal of Monetary Economics, No. 7, pp. 151-174
- Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
- Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
Comments
Article is closed for comments.