Hp detrend correlation

From XuShuwenn/RedAct · View interactive version

Hp detrend correlation is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Detrend macroeconomic time series with the HP filter (on log real values) and compute Pearson correlation, robust to mixed annual/quarterly Excel tables and CPI deflation.

How to use this skill

Skill file

HP Detrending and Business-Cycle Correlation

A reusable workflow to compute the correlation between cyclical components of two macroeconomic series. It covers extracting annual totals from ERP-style Excel tables that mix annual and quarterly rows, deflating with CPI, log-transforming, HP filtering (λ=100 for annual), and computing the Pearson correlation.

When to Use

Use this skill when you need to:

Core Workflow

1) Inspect and Load Data

2) Parse Annual vs Quarterly Rows

3) Align the Two Series by Year

4) Merge CPI and Deflate to Real Values

5) Log Transform and HP Filter

6) Compute Pearson Correlation and Output

Verification

Before finalizing the result, run these checks:

Common Pitfalls

Success Criteria

Optional Script Usage

The included helper scripts provide reusable parsing and analysis utilities.

Example (Python):

CLI example:

These utilities are generic and can be adapted to other macro series requiring business-cycle correlation analysis.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.