Decomposes macroeconomic time series into trend and cycle with the Hodrick-Prescott (HP) filter and two data-driven versions of it. The modified HP filter of McDermott (1997), assessed by Choudhary, Hanif and Iqbal (2014) <doi:10.1080/00036846.2014.894631>, chooses the smoothing parameter of every series by generalised cross-validation (as described in Coe and McDermott (1997) <doi:10.2307/3867497>). The fully modified HP filter of Hanif, Iqbal and Choudhary (2017, State Bank of Pakistan Working Paper 88) also reduces the end-point bias of the HP filter: it raises the smoothing parameter at the first and last observations, with linear or quadratic weights chosen to minimise the loss of Bloechl (2014, University of Munich Discussion Paper 2014-1). Every filter is a banded linear solve, so the searches are fast; batch processing of many series, comparisons of the filters, the filter weights, gain functions and end-point loss, simulation of trend-plus-cycle series and the power comparison of the paper, 'ggplot2' graphics, a plain-language interpretation of every result and a built-in 'shiny' application.
| Version: | 1.0.0 |
| Depends: | R (≥ 4.2) |
| Imports: | data.table, ggplot2, grDevices, Rcpp, scales, stats, utils |
| LinkingTo: | Rcpp, RcppArmadillo |
| Suggests: | bslib, DT, knitr, magick, pkgload, quarto, ragg, R.rsp, shiny, svglite, testthat (≥ 3.0.0), withr |
| Published: | 2026-11-09 |
| DOI: | 10.32614/CRAN.package.mhpfilter |
| Author: | Muhammad Yaseen |
| Maintainer: | Muhammad Yaseen <myaseen208 at gmail.com> |
| BugReports: | https://github.com/myaseen208/mhpfilter/issues |
| License: | MIT + file LICENSE |
| Copyright: | see file COPYRIGHTS |
| URL: | https://myaseen208.com/mhpfilter/, https://github.com/myaseen208/mhpfilter |
| NeedsCompilation: | yes |
| Language: | en-US |
| Citation: | mhpfilter citation info |
| Materials: | README, NEWS |
| CRAN checks: | mhpfilter results |
| Package source: | mhpfilter_1.0.0.tar.gz |
| Windows binaries: | r-devel: mhpfilter_0.1.0.zip, r-release: mhpfilter_0.1.0.zip, r-oldrel: mhpfilter_0.1.0.zip |
| macOS binaries: | r-release (arm64): mhpfilter_1.0.0.tgz, r-oldrel (arm64): mhpfilter_1.0.0.tgz, r-release (x86_64): mhpfilter_0.1.0.tgz, r-oldrel (x86_64): mhpfilter_0.1.0.tgz |
| Old sources: | mhpfilter archive |
Please use the canonical form https://CRAN.R-project.org/package=mhpfilter to link to this page.