Crandore Hub

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.

Versions across snapshots

VersionRepositoryFileSize
0.1.0 rolling linux/jammy R-4.5 mhpfilter_0.1.0.tar.gz 546.1 KiB
0.1.0 rolling linux/noble R-4.5 mhpfilter_0.1.0.tar.gz 547.7 KiB
0.1.0 rolling source/ R- mhpfilter_0.1.0.tar.gz 439.9 KiB
0.1.0 latest linux/jammy R-4.5 mhpfilter_0.1.0.tar.gz 546.1 KiB
0.1.0 latest linux/noble R-4.5 mhpfilter_0.1.0.tar.gz 547.7 KiB
0.1.0 latest source/ R- mhpfilter_0.1.0.tar.gz 439.9 KiB
0.1.0 2026-04-26 source/ R- mhpfilter_0.1.0.tar.gz 439.9 KiB
0.1.0 2026-04-23 source/ R- mhpfilter_0.1.0.tar.gz 439.9 KiB
0.1.0 2026-04-09 windows/windows R-4.5 mhpfilter_0.1.0.zip 867.7 KiB

Dependencies (latest)

Imports

LinkingTo

Suggests