Package: mhpfilter 0.1.0

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.zip(r-4.7)mhpfilter_0.1.0.zip(r-4.6)mhpfilter_0.1.0.zip(r-4.5)
mhpfilter_0.1.0.tgz(r-4.6-x86_64)mhpfilter_0.1.0.tgz(r-4.6-arm64)mhpfilter_0.1.0.tgz(r-4.5-x86_64)mhpfilter_0.1.0.tgz(r-4.5-arm64)
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://myaseen208.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

4.60 score 2 stars 153 downloads 9 exports 21 dependencies

Last updated from:308f6886e1. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK164
linux-devel-x86_64OK169
source / vignettesOK224
linux-release-arm64OK162
linux-release-x86_64OK183
macos-release-arm64OK152
macos-release-x86_64OK232
macos-oldrel-arm64OK98
macos-oldrel-x86_64OK243
windows-develOK151
windows-releaseOK157
windows-oldrelOK131
wasm-releaseOK137

Exports:batch_compareget_gcvget_lambdahp_filtermhp_batchmhp_comparemhp_filterplot_batchplot_comparison

Dependencies:clicollapsecpp11data.tablefarverggplot2gluegtableisobandlabelinglifecycleR6RColorBrewerRcppRcppArmadillorlangS7scalesvctrsviridisLitewithr

Introduction to mhpfilter

Rendered fromintroduction.Rmdusingknitr::rmarkdownon May 15 2026.

Last update: 2026-02-06
Started: 2026-02-06

Modified HP Filter: Theory and Methodology

Rendered frommethodology.Rmdusingknitr::rmarkdownon May 15 2026.

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