Skip to content

trendseries 1.0.0 - Production Release

Choose a tag to compare

@viniciusoike viniciusoike released this 03 Oct 12:52
· 118 commits to main since this 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() and extract_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

💡 Key Innovations

Unified Parameter System

Use consistent parameters across methods:

  • window: Period for moving averages and related methods
  • smoothing: Smoothness control for HP, loess, splines
  • band: Frequency bands for bandpass filters
  • align: 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