Skill

Decompose Time Series Data

Separates time series into trend, seasonal, and residual components with statistical and signal-processing methods.

Works with pandasnumpystatsmodelsmatplotlibscipy

91
Spark score
out of 100
Updated 3 months ago
Source checked Oct 11, 2026
Version 1.0.0
Models

Add to Favorites

Why it matters

Decompose complex time series data into its fundamental components: trend, seasonality, and residuals. This asset provides robust methods for understanding temporal patterns and improving forecasting accuracy.

Outcomes

What it gets done

01

Apply classical decomposition methods like Moving Average and STL.

02

Utilize advanced techniques including X-13ARIMA-SEATS, EMD, and Wavelet Decomposition.

03

Assess decomposition quality using diagnostic metrics and visualizations.

04

Generate Python code for various decomposition algorithms.

Install

Add it to your toolbox

Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-time-series-decomposition | bash

After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.

Reports

Agent outcome reports

No reports yet

Overview

A method guide for decomposing time series and checking whether components are useful. Use it when exploring temporal patterns, seasonality, trend, or multi-scale signal behavior.

What it does

Time Series Decomposition Expert explains how to separate temporal data into trend, seasonal, cyclical, and residual components. It covers additive and multiplicative models, classical moving-average decomposition, STL, X-13ARIMA-SEATS, empirical mode decomposition, ensemble EMD, wavelets, diagnostic assessment, visualization, and method selection. The goal is to make patterns interpretable and useful for analysis.

When to use - and when NOT to

Use decomposition when analyzing trend and recurring patterns or distinguishing systematic behavior from residual variation. Classical decomposition and STL are presented for regular seasonality; X-13 is described for economic or business series requiring trading-day adjustment; EMD and EEMD address nonlinear or nonstationary data; wavelets support multi-resolution analysis. Consider trend-only models when seasonal strength is low, and robust methods when noise is high.

Inputs and outputs

Inputs include a time-indexed series, its frequency or period, model choice, seasonal smoother, trend settings, and any domain context. A decomposition can return the observed series, trend, seasonal component, and residual or irregular component. Additive models express the series as trend plus seasonal plus residual; multiplicative models combine those components by multiplication. STL offers a robust option and flexible seasonal and trend parameters. An adaptive example infers frequency and selects seasonal lengths for daily, hourly, monthly, or quarterly data.

The classical example calls statsmodels.tsa.seasonal.seasonal_decompose(ts, model="additive", period=12); the period must reflect the series cadence. The adaptive STL example uses STL(ts, seasonal=seasonal_length, robust=True) and can derive seasonal_length from the inferred observation frequency.

X-13 examples include trading-day adjustment, automatic outlier handling, and extending the series for seasonal factors, with a fallback to STL when the external software is unavailable. EMD examples return intrinsic mode functions and a residue; EEMD adds an ensemble for noise robustness. Wavelet examples use discrete transforms to separate a low-frequency approximation from detail components, and continuous transforms to produce coefficients, frequencies, and scales.

Integrations

The examples use Python, pandas, NumPy, statsmodels, PyEMD, PyWavelets, SciPy, and Matplotlib. Diagnostic code calculates reconstruction mean squared and absolute errors, tests residual autocorrelation with Ljung-Box, checks normality with Shapiro, and estimates trend and seasonal strength. Visualization arranges the observed series, trend, seasonality, and residuals in aligned panels.

Parameter guidance suggests odd STL seasonal lengths, often 7-15 for strong seasonality; db4 for general wavelet use, haar for sharp changes, and coif2 for smooth data. For EMD, it suggests starting max_imf around data length divided by ten, then adjusting based on meaningful components. Always assess residual diagnostics and use domain knowledge to judge whether components are interpretable.

Who it's for

Analysts, statisticians, forecasting practitioners, and engineers working with temporal data can use these methods to explore seasonality and signal structure before building further analyses or models.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.