Package: MacroFilters 0.2.1

MacroFilters: Robust Trend-Cycle Decomposition for Macroeconomic Time Series

Provides high-performance tools for macroeconomic trend extraction and filtering, specifically designed to solve the end-point problem in real-time. Implements the MacroBoost Hybrid (MBH) filter using penalized P-splines and gradient boosting. Unlike the standard Hodrick-Prescott filter, 'MacroFilters' utilizes component-wise L2-boosting with robust loss functions (Huber) to handle extreme transient shocks (e.g., COVID-19) without inducing spurious trend shifts. The algorithm includes an automated two-layer diagnostic stage for unit roots and structural breaks, optimized via corrected AICc for computational efficiency. Methodology detailed in Kinel (2026) <doi:10.2139/ssrn.6371138>.

Authors:Michal Kinel [aut, cre]

MacroFilters_0.2.1.tar.gz
MacroFilters_0.2.1.zip(r-4.7-any)MacroFilters_0.2.1.zip(r-4.6-any)MacroFilters_0.2.1.zip(r-4.5-any)
MacroFilters_0.2.1.tgz(r-4.6-any)MacroFilters_0.2.1.tgz(r-4.5-any)
MacroFilters_0.2.1.tar.gz(r-4.7-any)MacroFilters_0.2.1.tar.gz(r-4.6-any)
MacroFilters_0.2.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
MacroFilters/json (API)

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

Bug tracker:https://github.com/michal0091/macrofilters/issues

Pkgdown/docs site:https://michal0091.github.io

Datasets:

On CRAN:

Conda:

6.30 score 11 stars 8 scripts 335 downloads 5 exports 38 dependencies

Last updated from:6bdff4954d. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK170
source / vignettesOK244
linux-release-x86_64OK166
macos-release-arm64OK139
macos-oldrel-arm64OK147
windows-develOK125
windows-releaseOK116
windows-oldrelOK103
wasm-releaseOK114

Exports:autoplotbhp_filterhamilton_filterhp_filtermbh_filter

Dependencies:clicpp11curldata.tablefarverFormulaggplot2gluegtableinumisobandjsonlitelabelinglatticelibcoinlifecycleMatrixmboostmvtnormnnlspartykitquadprogquantmodR6RColorBrewerrlangrpartS7scalesstabssurvivaltseriesTTRvctrsviridisLitewithrxtszoo

Hyperparameter Tuning for the MacroBoost Hybrid Filter
1 Anatomy of the MBH Trifecta | 1.1 mstop — iteration budget | 1.2 nu — shrinkage | 1.3 knots — spline flexibility | 2 Auto-calibration of Huber Delta d | 2.1 Scale invariance | 2.2 Scale-mismatch warning for log-level input | 3 Overriding d for High-Volatility Series | 4 Computational Trade-off Benchmark | Practical guidance | 5 Summary

Last update: 2026-06-11
Started: 2026-03-17

Introduction to MacroFilters
1. Introduction: Trend-Cycle Decomposition | The outlier problem | 2. Input Agnosticism: Bring Your Own Class | Example: same filter, two input formats | 3. The Filter Arsenal | 3.1 hp_filter() — Sparse Hodrick-Prescott | 3.2 hamilton_filter() — Regression-Based Alternative | 3.3 bhp_filter() — Boosted HP | 4. The Crown Jewel: mbh_filter() | The Problem with Squared Loss | The MBH Solution: Huber Loss + Boosting | Additive Model | Parameters | Quick example | 5. The macrofilter S3 Class | Printing | Accessing components | Inspecting metadata | Plotting cycles side by side | References

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

Solving the End-Point Problem in Real-Time
1 The End-Point Problem | 2 Expanding-Window Simulation | 3 The Role of boundary.knots | 4 Vintage Fan Chart | 5 The Backward Revision Test | Summary

Last update: 2026-06-11
Started: 2026-03-17

Uncertainty Bands via Block Bootstrap
1. Why quantify trend uncertainty? | 2. The mechanics | 3. Bands for every filter | Reading the end-point fan | A note on the Hamilton band | 4. References

Last update: 2026-05-31
Started: 2026-05-31