decompose_series() is now exported and available for use. This
pipe-friendly function decomposes a time series into trend, seasonal, and
remainder components (via STL or regression-based decomposition), adding
trend_*, seasonal_*, and remainder_* columns to the input data frame.
It supports grouped decomposition via group_cols and guarantees the exact
identity value = trend + seasonal + remainder. See the new
Decomposing Series vignette.
decompose_series() gained three additional methods:
"classic" — classical decomposition via centred moving averages
(stats::decompose())."bsm" — Basic Structural (state-space) Model estimated by the Kalman
smoother (stats::StructTS()), producing components for every observation."seats" — X-13ARIMA-SEATS decomposition via the optional seasonal
package (a Suggested dependency, only required for this method).decompose_series() gained three usability features:
methods now accepts a vector (e.g. c("stl", "classic")), adding each
method's components as separate columns for side-by-side comparison.transform = "log" argument provides a uniform multiplicative
decomposition across every method (decompose on the log scale, exponentiate
back), so value = trend * seasonal * remainder holds exactly.seasadj = TRUE argument adds a seasadj_{method} column with the
seasonally adjusted series.deseason_series() is a new convenience wrapper around decompose_series()
focused on seasonal adjustment. It adds a seasadj_{method} column with the
deseasoned series (methods "stl" or "seats"), and optionally the full
trend/seasonal/remainder decomposition via components = TRUE.
Added a Trend Extraction Methods vignette cataloguing all 20 trend methods by family — when to use each one and which parameters it takes.
augment_trends() and extract_trends() can never drift out of
sync.Release Date: 2026-05-02
group_vars argument in augment_trends() is deprecated in favour of
group_cols. A deprecation warning is now issued when group_vars is used.
group_vars will be removed in a future release.augment_trends() now accepts multiple value columns via a character vector
in value_col. Trends are extracted for each column and named
trend_{method}_{col} (e.g. trend_stl_consumption).
Improved UCM (Unobserved Components Model) trend extraction. The model now
uses fixed variance components with signal-to-noise ratios derived from
Hodrick-Prescott filter lambdas, producing smoother, economically meaningful
trends by default. The smoothing parameter can be used to override the
default.
Added London Underground transit datasets: transit_london_monthly and
transit_london_avgs.
group_cols instead of deprecated group_vars.Release Date: November 2025
Removed Butterworth filter: The Butterworth low-pass filter has been removed to focus the package on core econometric methods. The signal package dependency has been removed.
Removed Savitzky-Golay filter: The Savitzky-Golay polynomial smoothing filter has been removed to streamline the package. The signal package dependency has been removed.
Removed exponential smoothing methods: Simple and double exponential smoothing (exp_simple, exp_double) have been removed. Users can continue using EWMA for exponential smoothing. The forecast package dependency has been removed.
Release Date: January 2025
Implemented econometrically correct 2xN MA for centered even-window moving averages:
window=12, align="center" now correctly applies a 2x12 MA instead of naive centeringFixed misleading "2x" notation in messages:
Added comprehensive tests for 2xN MA:
glue package to Imports for message formatting.ma_2x() internal function implementing proper double-smoothing.ensure_odd_window() utility function for future useThis is an important correctness fix for users doing seasonal adjustment or business cycle analysis with monthly/quarterly data. The new implementation ensures that centered moving averages with even windows produce econometrically sound results.
Release Date: January 2025
This is the first production release of trendseries, providing a modern, pipe-friendly interface for extracting trends from economic time series data.
21 Trend Extraction Methods:
Two-Function API:
augment_trends(): Pipe-friendly function for tibble/data.frame workflows with grouped operationsextract_trends(): Direct time series analysis for ts/xts/zoo objectsUnified Parameter System: Consistent interface with window, smoothing, band, align, and params parameters across all methods
Smart Economic Defaults:
Performance Optimizations:
hp_onesided=TRUE parameter for nowcasting and policy analysis|>, cli messaging, comprehensive error handlingThe package includes 10 economic datasets for examples and testing:
gdp_construction, ibcbr, vehicles, oil_derivatives, electricretail_households, retail_autofuelcoffee_arabica, coffee_robusta (daily data)series_metadataOptimized for monthly (frequency=12) and quarterly (frequency=4) economic data, with smart defaults tailored for business cycle analysis. Methods like STL and moving averages also support daily and other frequencies.
# Install from GitHub
# install.packages("devtools")
devtools::install_github("viniciusoike/trendseries")
This package builds upon excellent work from the R community: mFilter (economic filters), hpfilter (one-sided HP filter), RcppRoll (fast C++ rolling statistics), forecast (exponential smoothing), dlm (Kalman filtering), signal (signal processing), tsbox (time series conversions).