timeseries-detrending
Tools and techniques for detrending time series data in macroeconomic analysis. Use when working with economic time series that need to be decomposed into trend and cyclical components. Covers HP filter, log transformations for growth series, and correlation analysis of business cycles.
npx skills add majiayu000/claude-skill-registry --skill timeseries-detrending-benchflow-ai-skillsbench-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Time Series Detrending for Macroeconomic Analysis This skill provides guidance on decomposing economic time series into trend and cyclical components, a fundamental technique in business cycle analysis. ## Overview Economic time series like GDP, consumption, and investment contain both long-term trends and short-term fluctuations (business cycles). Separating these components is essential for: - Analyzing business cycle correlations - Comparing volatility across variables - Identifying leading/lagging indicators ## The Hodrick-Prescott (HP) Filter The HP filter is the most widely used method for detrending macroeconomic data. It decomposes a time series into a trend component and a cyclical component. ### Mathematical Foundation Given a time series $y_t$, the HP filter finds the trend $\tau_t$ that minimizes: $$\sum_{t=1}^{T}(y_t - \tau_t)^2 + \lambda \sum_{t=2}^{T-1}[(\tau_{t+1} - \tau_t) - (\tau_t - \tau_{t-1})]^2$$ Where: - First term: Minimizes deviation of data from trend - Second term: Penalizes changes in the trend's growth rate - $\lambda$: Smoothing parameter controlling the trade-off ### Choosing Lambda (λ) **Critical**: The choice of λ depends on data frequency: | Data
- Overview
- The Hodrick-Prescott (HP) Filter
- Mathematical Foundation
- Choosing Lambda (λ)
- Python Implementation
- Log Transformation for Growth Series
- Why Use Logs?
- When NOT to Use Logs
- Complete Workflow for Detrending
- Step-by-Step Process
- Example: Business Cycle Correlation
- Dependencies
pip install statsmodels pandas numpy
What does the timeseries-detrending skill do?
Tools and techniques for detrending time series data in macroeconomic analysis. Use when working with economic time series that need to be decomposed into trend and cyclical components. Covers HP filter, log transformations for growth series, and correlation analysis of business cycles.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill timeseries-detrending-benchflow-ai-skillsbench-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
