Package: mhpfilter 0.1.0

Muhammad Yaseen

mhpfilter: Modified Hodrick-Prescott Filter with Optimal Smoothing Parameter Selection

High-performance implementation of the Modified Hodrick-Prescott (HP) Filter for decomposing macroeconomic time series into trend and cyclical components. Based on the methodology of Choudhary, Hanif and Iqbal (2014) <doi:10.1080/00036846.2014.894631> "On smoothing macroeconomic time series using the modified HP filter", which uses generalized cross-validation (GCV) to automatically select the optimal smoothing parameter lambda, following McDermott (1997) "An automatic method for choosing the smoothing parameter in the HP filter" (as described in Coe and McDermott (1997) <doi:10.2307/3867497>). Unlike the standard HP filter that uses fixed lambda values (1600 for quarterly, 100 for annual data), this package estimates series-specific lambda values that minimize the GCV criterion. Implements efficient C++ routines via 'RcppArmadillo' for fast computation, supports batch processing of multiple series, and provides comprehensive visualization tools using 'ggplot2'. Particularly useful for cross-country macroeconomic comparisons, business cycle analysis, and when the appropriate smoothing parameter is uncertain.

Authors:Muhammad Yaseen [aut, cre], Javed Iqbal [ctb], M. Nadim Hanif [ctb]

mhpfilter_0.1.0.tar.gz
mhpfilter_0.1.0.tar.gz(r-4.7-arm64)mhpfilter_0.1.0.tar.gz(r-4.7-x86_64)mhpfilter_0.1.0.tar.gz(r-4.6-arm64)mhpfilter_0.1.0.tar.gz(r-4.6-x86_64)
mhpfilter_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
mhpfilter/json (API)
NEWS

# Install 'mhpfilter' in R:
install.packages('mhpfilter', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/myaseen208/mhpfilter/issues

Pkgdown/docs site:https://myaseen208.com

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

openblascpp

3.00 score 1 stars 142 downloads 9 exports 21 dependencies

Last updated from:c73a77f5d8. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK164
linux-devel-x86_64OK176
source / vignettesOK252
linux-release-arm64OK202
linux-release-x86_64OK171
wasm-releaseOK137

Exports:batch_compareget_gcvget_lambdahp_filtermhp_batchmhp_comparemhp_filterplot_batchplot_comparison

Dependencies:clicollapsecpp11data.tablefarverggplot2gluegtableisobandlabelinglifecycleR6RColorBrewerRcppRcppArmadillorlangS7scalesvctrsviridisLitewithr

Introduction to mhpfilter

Rendered fromintroduction.Rmdusingknitr::rmarkdownon May 26 2026.

Last update: 2026-02-13
Started: 2026-02-13

Modified HP Filter: Theory and Methodology

Rendered frommethodology.Rmdusingknitr::rmarkdownon May 26 2026.

Last update: 2026-02-13
Started: 2026-02-13