trendseries 1.0.0 - Production Release
trendseries 1.0.0 - Production Release 🎉
First production release of trendseries, a modern R package for extracting trends from economic time series.
🌟 Highlights
- 21 trend extraction methods covering econometric filters, moving averages, smoothing, and signal processing
- Two-function API (
augment_trends()andextract_trends()) for different workflows - Production-quality code with 0 errors/warnings/notes in R CMD check
- 317 passing tests ensuring reliability
- Comprehensive documentation with real-world examples
📊 Key Features
Econometric Methods
- Hodrick-Prescott (HP) filter - One-sided and two-sided variants for business cycle analysis
- Baxter-King - Bandpass filter for isolating business cycle frequencies
- Christiano-Fitzgerald - Asymmetric bandpass filter
- Hamilton regression filter - Alternative to HP filter (Hamilton 2018)
- Beveridge-Nelson decomposition - Permanent/transitory decomposition
- Unobserved Components Model (UCM) - State space modeling
Moving Averages & Smoothing
- Simple, Weighted, Exponential (EWMA), Zero-lag (ZLEMA)
- Triangular, Median, Gaussian-weighted
- STL decomposition - Seasonal-trend decomposition
- Loess, Splines, Polynomial trends
- Exponential smoothing - Simple and double (Holt)
Advanced Signal Processing
- Kalman filter/smoother - Adaptive filtering for noisy series
- Savitzky-Golay filter - Polynomial smoothing preserving peaks
- Butterworth filter - Clean frequency domain filtering
- Kernel smoother - Non-parametric regression
🎯 Quality Metrics
- ✅ R CMD check: 0 errors | 0 warnings | 0 notes (perfect score)
- ✅ Test coverage: 317 tests passing across 9 test files
- ✅ Documentation: All examples verified working
- ✅ Modern R: Native pipe
|>, cli messaging, tidyverse patterns - ✅ Performance: C++ optimizations via RcppRoll
📚 Getting Started
Installation
# Install from GitHub
# install.packages("devtools")
devtools::install_github("viniciusoike/trendseries")Quick Example
library(trendseries)
# Pipe-friendly workflow with tibbles
gdp_construction |>
augment_trends(
value_col = "gdp_construction",
methods = c("hp", "bk", "ma")
)
# Direct time series analysis
ts_data <- df_to_ts(gdp_construction, frequency = 4)
extract_trends(ts_data, methods = "hp")
# Multiple methods with unified parameters
gdp_construction |>
augment_trends(
value_col = "gdp_construction",
methods = c("hp", "loess", "ma"),
smoothing = 0.3, # Applies to hp and loess
window = 8 # Applies to ma
)📖 Documentation
- Package Website - Full documentation and examples
- Getting Started Vignette - Step-by-step introduction
- Moving Averages Vignette - Deep dive into MA methods
- GitHub Repository - Source code and issues
💡 Key Innovations
Unified Parameter System
Use consistent parameters across methods:
window: Period for moving averages and related methodssmoothing: Smoothness control for HP, loess, splinesband: Frequency bands for bandpass filtersalign: Positioning for moving averages (left/center/right)params: Method-specific fine control
Smart Economic Defaults
- HP filter: λ=1600 (quarterly), λ=14400 (monthly)
- Moving averages: 4-quarter/12-month windows
- Bandpass filters: 6-32 quarter business cycle range
Flexible Data Support
Optimized for monthly/quarterly economic data with smart defaults, but methods like STL and moving averages support daily and other frequencies.
📦 Included Datasets
10 economic datasets for examples and testing:
- Brazilian data (BCB): GDP, economic activity, vehicles, energy
- UK data (ONS): Retail sales
- Coffee prices (CEPEA): Daily arabica and robusta prices
🙏 Acknowledgments
Built on excellent work from: mFilter (economic filters), hpfilter (one-sided HP), RcppRoll (fast C++ rolling stats), forecast (exponential smoothing), dlm (Kalman filtering), signal (signal processing), tsbox (time series conversions).
📝 Full Changelog
See NEWS.md for complete release notes.
Questions or feedback? Open an issue at https://github.com/viniciusoike/trendseries/issues